2012年3月20日
摘要:
先调用setSize() 最后调用setVisible()
阅读全文
posted @ 2012-03-20 17:47
aparche
阅读(713)
推荐(0)
2012年3月19日
摘要:
1、将皮肤jar包导入项目中2、找到皮肤类,一般是以LookAndFeel结尾的类就是皮肤类3、在程序入口处,使用下面的代码进行添加皮肤效果:public static void main(String args[]) {try {UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceSaharaLookAndFeel");//其中org.jvnet.substance.skin为包名,SubstanceSaharaLookAndFeel为皮肤类名} catch (Exception ex) {ex.prin
阅读全文
posted @ 2012-03-19 00:16
aparche
阅读(4825)
推荐(0)
2012年3月17日
摘要:
方法一:import java.awt.FlowLayout;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import javax.swing.*;public class JPopupMenuTest extends JFrame {public JPopupMenuTest() {JButton button = new JButton("登录");this.add(button);//为按钮添加单击事件bu
阅读全文
posted @ 2012-03-17 15:18
aparche
阅读(11281)
推荐(1)
2012年3月15日
摘要:
File->New->Android Project打开创建Android项目的对话框,选择Creat project from existing source,然后在Location选择要导入的Android项目就OK了。一个正常的Android项目导入后出现错误,可能是SDK版本不兼容,需要修改项目中的版本,打开项目中的project.properties文件把里面的target=android-7进行相应版本的修改,例如android-7是SDK 2.1,android-5是SDK 2.0,修改成功后保存,项目应该就没问题了
阅读全文
posted @ 2012-03-15 23:24
aparche
阅读(2752)
推荐(0)
2012年3月14日
摘要:
java项目打jar包分为2种情况:一、java项目没有导入第三方jar包这时候打包就比较简单:1. 首先在Eclipse中打开项目, 右键点击项目,选择“Export”;2. 选择Java/JAR file,Next;3. Select the resources to export中可以选择你想要包含的项目文件夹,一些不必要的文件夹就无需放进去了,免得增大空间;这里有几个选项: * Export generated class files and resources 表示只导出生成的.class文件和其他资源文件 * Export all output folders for checke
阅读全文
posted @ 2012-03-14 17:56
aparche
阅读(30748)
推荐(2)
2012年3月12日
摘要:
一、boolean execute(String sql)允许执行查询语句、更新语句、DDL语句。返回值为true时,表示执行的是查询语句,可以通过getResultSet方法获取结果;返回值为false时,执行的是更新语句或DDL语句,getUpdateCount方法获取更新的记录数量。例子:public static void main(String[] args) {Connection conn = null;Statement stm = null;ResultSet rs = null;try {Class.forName("com.microsoft.sqlserver
阅读全文
posted @ 2012-03-12 09:46
aparche
阅读(29421)
推荐(2)
2012年3月7日
摘要:
import java.awt.Component;import java.awt.Container;import javax.swing.ImageIcon;import javax.swing.JComponent;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTable;import javax.swing.table.TableCellRenderer;public class aaa {public aaa() {}public st
阅读全文
posted @ 2012-03-07 12:03
aparche
阅读(3709)
推荐(0)
摘要:
public aaa() {initComponents();this.getRootPane().setDefaultButton(this.jButton1);//获取焦点this.jButton1.addKeyListener(new KeyAdapter() {public void keyPressed(KeyEvent event) {if (event.getKeyText(event.getKeyCode()).compareToIgnoreCase("Enter") == 0) {doClick();}}});}public void doClick()
阅读全文
posted @ 2012-03-07 11:21
aparche
阅读(1655)
推荐(0)
摘要:
对JTextArea操作append动态数据的时候。 每次插入一行后需要使用JTextArea.selectall(); 以便使jscrollpanel的滚动条定位到最后一行记录。
阅读全文
posted @ 2012-03-07 09:11
aparche
阅读(779)
推荐(0)
2012年3月6日
摘要:
代码:import java.awt.FlowLayout;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;public class JFrameBackground {private JFrame frame = new JFrame("背景图片测试");private JPanel imagePanel;private ImageIcon backgro
阅读全文
posted @ 2012-03-06 16:43
aparche
阅读(37035)
推荐(1)