package Frame; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Iterator; import java.util.List; import java.util.Vector; import javax.swing.Box; import javax.swing.ImageIcon; import javax.swing.JInternalFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; import ColorAndFont.English; import ColorAndFont.NothJPanel; import ColorAndFont.UIColor; import ColorAndFont.buttonTitle; import DataBase.DatabaseManagement; import Method.Serch; import PbuliClass.JButtonModel ; import PbuliClass.OutButton; import PbuliClass.ShowMessage; import PbuliClass.Systems; import PbuliClass.WarningMessage; import PbuliClass.greateTables; import PbuliClass.jinternalFrame; /**ÐÅÏ¢·¢ËͼǼ*/ @SuppressWarnings("rawtypes") public class Taglixianrecord extends jinternalFrame { /** * */ private static final long serialVersionUID = 1L; jinternalFrame jinerFrame=null; JInternalFrame jinFrame=null; NothJPanel northPanel=null;//±±²¿Ãæ°å JTextField searchFileld=null;//ËÑË÷Îı¾¿ò JButtonModel search=null;//ËÑË÷°´Å¥ JButtonModel shuaxin=null;//ˢа´Å¥ JButtonModel add=null;//ÐÂÔö°´Å¥ JButtonModel alter=null;//Ð޸İ´Å¥ JButtonModel delete=null;//ɾ³ý°´Å¥ JButtonModel deleteAll=null;//È«²¿É¾³ý°´Å¥ JButtonModel enterPort=null;//µ¼ÈëÈËÔ±°´Å¥ OutButton outbt=new OutButton(); JButtonModel download=null;//Ä£°åÏÂÔØ°´Å¥ JScrollPane gd=null;//¹ö¶¯Ãæ°å JTable table=null;//ÉêÃ÷±í¸ñ Vector rowData=null; DefaultTableModel tableModel=null;//ÉùÃ÷±í¸ñÄ£ÐÍ List list=null; int selectedRow;//±»Ñ¡ÖеÄÐÐ Container rq; String sql="select id,tagid,name,bumen,phone,time from tb_lixianrecord_0829 order by id desc limit 1000"; public Taglixianrecord() {//¹¹Ôì·½·¨ rowData=new Vector(); rq=getContentPane();//»ñÈ¡ÈÝÆ÷ rq.setLayout(new BorderLayout()); rq.setBackground(Color.white); String title="±êÇ©ÀëÏ߼Ǽ±í"; if(Systems.sys().getLanguage().equals("English")) { title="message send Record"; } this.setTitle(title); this.setFrameIcon(new ImageIcon("image/icon/sosicon.png"));//ÉèÖô°Ìåͼ±ê rq.add(getNorthPanel(),BorderLayout.NORTH); rq.add(getGd(),BorderLayout.CENTER); } /**»ñÈ¡±±²¿Ãæ°åµÄ·½·¨*/ public NothJPanel getNorthPanel() { if(northPanel==null) { northPanel=new NothJPanel(); Box topicBox = Box.createHorizontalBox();// ´´½¨Ò»¸öˮƽÏäÈÝÆ÷ topicBox.add(getSearchFileld());//Ìí¼ÓËÑË÷Îı¾¿ò topicBox.add(Box.createHorizontalStrut(3));// Ìí¼ÓÒ»¸ö3ÏñËØ¿íµÄˮƽ֧Öù topicBox.add(getSearch());//Ìí¼ÓËÑË÷°´Å¥ topicBox.add(Box.createHorizontalStrut(5));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù topicBox.add(getShuaxin());//Ìí¼Óˢа´Å¥ topicBox.add(Box.createHorizontalStrut(5));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù topicBox.add(getDelete());//Ìí¼Óɾ³ý°´Å¥ topicBox.add(Box.createHorizontalStrut(5));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù topicBox.add(getDeleteAll());//Ìí¼Óɾ³ýÈ«²¿°´Å¥ topicBox.add(Box.createHorizontalStrut(5));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù topicBox.add(getDao_chu_table());//Ìí¼Óɾ³ýÈ«²¿°´Å¥ northPanel.add(topicBox ); } return northPanel; } /**»ñÈ¡ËÑË÷Îı¾¿òµÄ·½·¨*/ public JTextField getSearchFileld() { if(searchFileld==null){ searchFileld=new JTextField(10); searchFileld.addKeyListener(new KeyListener() { //¼üÅÌʼþ¼àÌý public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { int keyCode=e.getKeyCode(); if(keyCode==KeyEvent.VK_ENTER) { getSearch().doClick();//ËÑË÷°´Å¥±»µã»÷ } } public void keyPressed(KeyEvent e) { } }); } return searchFileld; } /**»ñÈ¡ËÑË÷°´Å¥µÄ·½·¨*/ public JButtonModel getSearch() { if(search==null){ search=new JButtonModel (buttonTitle.getSerch()); search.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String text=searchFileld.getText().trim(); if(text.length()<1) { ShowMessage.zidingyi("ÄãËÑË÷µÄÄÚÈݲ»´æÔÚ"); return; } try { if(getSearchFileld().getText().length()>1) { String go=getSearchFileld().getText(); updateSerch(Serch.so("tb_lixianrecord_0829", go, "tagid", "info","sendtime")); } } catch (Exception er) { er.printStackTrace(); } } }); } return search; } /**»ñÈ¡µ¼³ö±í¸ñ°´Å¥µÄ·½·¨*/ public JButtonModel getDao_chu_table() { OutButton.setAddtime("intime"); OutButton.setDataName("tb_lixianrecord_0829"); return new OutButton().get_ouotport_button(); } /**»ñȡˢа´Å¥µÄ·½·¨*/ public JButtonModel getShuaxin() { if(shuaxin==null){ shuaxin=new JButtonModel (buttonTitle.getRefresh()); shuaxin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateTable() ; } }); } return shuaxin; } /**»ñÈ¡±í¸ñ±»Ñ¡ÖеÄÐз½·¨*/ public int getSelectedRow() { selectedRow=getTable().getSelectedRow(); return selectedRow; } /**»ñȡɾ³ý°´Å¥µÄ·½·¨*/ public JButtonModel getDelete() { if(delete==null){ delete=new JButtonModel (buttonTitle.getDelete()); delete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] selectedRows=table.getSelectedRows();//±»Ñ¡ÖÐÐеÄË÷Òý¼¯ºÏ if(selectedRows.length !=0) { for(int i=0;i row = new Vector<>(); List info = (List) iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½list¼¯ºÏ for(int i=0;i columnName=new Vector<>(); for(int i=0;i