资源描述:
《javaswing开发好关系软件基本信息界面代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、packagecom・kehuglxt・swingl;I]■MOimportjava・awt・BordcrLsyout;importjava.nwt.GridLayout;importjava・awt・event・ActionEvent;importjava.awt.event.ActionListener;importjava.util.List;importjavax・swing.JButton;importjavax・swing.JComboBox;importjavax・swing.JFrame;importjavax.swing.JLabel;importjavax・swing
2、.JPanel;importjavax・swing.JScrollPane;importjavax.swing.JTable;importjavax・swing.UTManager;importjavax.swing,border.EmptyBorder;importcom.java2012.Style-Book;importcom.java2012・Sty1・JDBCobject;importcom.java2012・Style.JDBCtablemodcl;publicclassJbxxbiaozhajmextendsJFrame{JPanelconJPanel;//表格JTab
3、leresultTable;//下拉列JComboBoxtermcoBox,termcoBoxl;//数据模型Jbxxbiaotablemojbxxbiaotablemo=newJbxxbiaotablemo();publicJbxxbiaozhajmO{//皮肤try{UIManager.setLookAndFeel("com.sun.java,swing,plaf.nimbus.NimbusLookAndFeel");}catch(Exceptione){//TODO:handleexception}//关闭setDefaultCloseOperation(JFrame.EXIT_O
4、N_CLOSE);//大小位置setBounds(50,50,800,600);//可见this・setVisible(true);conJPanel=newJPancl();//容器边框conJPanc1・sctBordcr(newEmptyBorder(5,5,5,5));//布局conJPanc1・sctLayout(null);//添加容器this・add(conJPanel);JPaneljpanel=newJPanel();jpanel.setBounds(0,0,750,550);conJPanel・add(jpanel);jpanel.setLayout(null);//
5、定义数组Stringstr[]=newString[]{"升序","降序"};Stringstrl[]=newString[]{〃升序",〃降序〃};//下拉列termcoBox二newJComboBox(str);//下拉列打下及位置termcoBox.setBounds(75,24,104,21);//下拉列termcoBox1=newJComboBox(stri);//下拉列打下及位置termcoBoxl.setBounds(135,24,104,21);//添加下拉列//jpanel.add(termcoBox):JLabellabel=newJLabel(,z查询条件");//
6、标签及大小及位置label.setBounds(50,30,100,50);//添加标签//jpanel.add(label);//按钮//添加按钮//jpancl.add(button);//滚动条JScrollPanescrollPane=newJScrollPane();//滚动条大小及位置scrollPane.setBounds(32,6&700,500);//表格resultTablc=nowJTablc();//表格添加模型resultTable.setModcl(jbxxbiaotablcmo);//滚动条添加表格scrollPanc.sctViewportViow(res
7、ultTablc);//添加表格//操作数据库Khshujujdbcutil=newKhshujujdbc();Listlist二util.getJbxxbeanO;for(inti=0;i