⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addrbook_dialog.java

📁 java课程设计的的许多源代码以及数据库联接
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    column8.setCaption("电子邮件");    column8.setColumnName("email");    column8.setDataType(com.borland.dx.dataset.Variant.STRING);    column8.setPrecision(15);    column8.setTableName("addrbook");    column8.setVisible(com.borland.jb.util.TriStateProperty.FALSE);    column8.setServerColumnName("email");    column8.setSqlType(12);    column9.setCaption("OICQ");    column9.setColumnName("oicq");    column9.setDataType(com.borland.dx.dataset.Variant.STRING);    column9.setPrecision(10);    column9.setTableName("addrbook");    column9.setVisible(com.borland.jb.util.TriStateProperty.FALSE);    column9.setServerColumnName("oicq");    column9.setSqlType(12);    column10.setCaption("单位");    column10.setColumnName("company");    column10.setDataType(com.borland.dx.dataset.Variant.STRING);    column10.setPrecision(20);    column10.setTableName("addrbook");    column10.setVisible(com.borland.jb.util.TriStateProperty.FALSE);    column10.setServerColumnName("company");    column10.setSqlType(12);    column11.setCaption("地址");    column11.setColumnName("address");    column11.setDataType(com.borland.dx.dataset.Variant.STRING);    column11.setPrecision(50);    column11.setTableName("addrbook");    column11.setVisible(com.borland.jb.util.TriStateProperty.FALSE);    column11.setServerColumnName("address");    column11.setSqlType(12);    column12.setCaption("备注");    column12.setColumnName("comments");    column12.setDataType(com.borland.dx.dataset.Variant.STRING);    column12.setSearchable(false);    column12.setTableName("addrbook");    column12.setVisible(com.borland.jb.util.TriStateProperty.FALSE);    column12.setServerColumnName("comments");    queryDataSet1.setColumns(new Column[] {column1, column2, column3, column4, column5, column6, column7, column8, column9, column10, column11, column12});    jdbTable1.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);    jdbTable1.setDataSet(queryDataSet1);    jdbTable1.setEditable(false);    jButton2.setText("新增");    jButton2.addActionListener(new AddrBook_Dialog_jButton2_actionAdapter(this));    jButton2.setFont(new java.awt.Font("DialogInput", 0, 12));    jButton3.setText("保存");    jButton3.addActionListener(new AddrBook_Dialog_jButton3_actionAdapter(this));    jButton3.setFont(new java.awt.Font("DialogInput", 0, 12));    jButton4.setText("删除");    jButton4.addActionListener(new AddrBook_Dialog_jButton4_actionAdapter(this));    jButton4.setFont(new java.awt.Font("DialogInput", 0, 12));    jButton5.setText("退出");    jButton5.addActionListener(new AddrBook_Dialog_jButton5_actionAdapter(this));    jButton5.setFont(new java.awt.Font("DialogInput", 0, 12));    getContentPane().add(panel1);    panel1.add(jPanel1,  new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 14, 0, 12), 17, 12));    jPanel1.add(jLabel2, new XYConstraints(232, 18, -1, -1));    jPanel1.add(jLabel1, new XYConstraints(12, 17, -1, -1));    jPanel1.add(jComboBox1, new XYConstraints(84, 14, 126, -1));    jPanel1.add(jTextField1, new XYConstraints(308, 17, 121, -1));    jPanel1.add(jButton1, new XYConstraints(442, 14, 73, -1));    panel1.add(tableScrollPane1,  new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(13, 14, 0, 0), -302, -90));    panel1.add(jPanel2,  new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(14, 7, 0, 12), 15, 11));    jPanel2.add(jdbTextField2, new XYConstraints(246, 20, 97, -1));    jPanel2.add(jdbTextField4, new XYConstraints(246, 55, 97, -1));    jPanel2.add(jLabel4, new XYConstraints(179, 22, -1, -1));    jPanel2.add(jLabel6, new XYConstraints(179, 57, -1, -1));    jPanel2.add(jdbTextField3, new XYConstraints(74, 53, 97, -1));    jPanel2.add(jdbTextField1, new XYConstraints(74, 18, 97, -1));    jPanel2.add(jLabel5, new XYConstraints(7, 55, -1, -1));    jPanel2.add(jLabel3, new XYConstraints(6, 20, -1, -1));    jPanel2.add(jLabel8,  new XYConstraints(179, 89, -1, -1));    jPanel2.add(jdbTextField6, new XYConstraints(246, 87, 97, -1));    jPanel2.add(jLabel7, new XYConstraints(8, 88, -1, -1));    jPanel2.add(jdbTextField5, new XYConstraints(75, 86, 97, -1));    jPanel2.add(jLabel9,  new XYConstraints(8, 121, -1, -1));    jPanel2.add(jdbTextField7, new XYConstraints(75, 119, 97, -1));    jPanel2.add(jLabel10, new XYConstraints(9, 153, -1, -1));    jPanel2.add(jdbTextField8,  new XYConstraints(76, 151, 268, -1));    jPanel2.add(jLabel11,  new XYConstraints(179, 121, -1, -1));    jPanel2.add(jdbTextField9, new XYConstraints(246, 119, 97, -1));    jPanel2.add(jLabel12,  new XYConstraints(10, 185, -1, -1));    jPanel2.add(jdbTextField10,  new XYConstraints(77, 183, 267, -1));    jPanel2.add(jLabel13,   new XYConstraints(11, 220, -1, -1));    jPanel2.add(jScrollPane1, new XYConstraints(13, 245, 333, 69));    panel1.add(jButton3,  new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(18, 0, 17, 0), 15, 0));    panel1.add(jButton2,  new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(17, 59, 17, 49), 15, 0));    panel1.add(jButton4,  new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(18, 52, 17, 0), 15, 0));    panel1.add(jButton5,  new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(19, 54, 17, 57), 15, 0));    jScrollPane1.getViewport().add(jdbTextArea1, null);    tableScrollPane1.getViewport().add(jdbTable1, null);    jComboBox1.addItem("按姓名查询");    jComboBox1.addItem("按关系查询");    jComboBox1.setSelectedIndex(-1);  }  void jButton1_actionPerformed(ActionEvent e) {    if(jComboBox1.getSelectedIndex()<0){      JOptionPane.showMessageDialog(this,"请选择查询条件");      return;    }    if(jTextField1.getText().length()==0){      JOptionPane.showMessageDialog(this,"请输入查询内容");      return;    }    String condition = "type";    if(jComboBox1.getSelectedIndex()==0)      condition="name";    if(queryDataSet1.isOpen()) queryDataSet1.close();    String sql = "select * from addrbook where "+condition+" = \'"        + jTextField1.getText() + "\'";    try{      queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(         database1,sql, null, true,Load.ALL));      queryDataSet1.open();    }catch(Exception ex){      JOptionPane.showMessageDialog(this,ex.toString());    }  }  void jButton2_actionPerformed(ActionEvent e) {    queryDataSet1.insertRow(false);  }  void jButton3_actionPerformed(ActionEvent e) {    try{       queryDataSet1.post();       queryDataSet1.saveChanges();       queryDataSet1.refresh();     }catch(Exception ex){       queryDataSet1.refresh();       JOptionPane.showMessageDialog(this,"性别只能是\'男\'\\\'女\'","提示",JOptionPane.ERROR_MESSAGE);     }  }  void jButton4_actionPerformed(ActionEvent e) {    try{      queryDataSet1.deleteRow();      queryDataSet1.post();      queryDataSet1.saveChanges();      queryDataSet1.refresh();    }catch(Exception ex){      queryDataSet1.refresh();      JOptionPane.showMessageDialog(this,ex.toString(),"提示",JOptionPane.ERROR_MESSAGE);    }  }  void jButton5_actionPerformed(ActionEvent e) {    this.dispose();  }}class AddrBook_Dialog_jButton1_actionAdapter implements java.awt.event.ActionListener {  AddrBook_Dialog adaptee;  AddrBook_Dialog_jButton1_actionAdapter(AddrBook_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}class AddrBook_Dialog_jButton2_actionAdapter implements java.awt.event.ActionListener {  AddrBook_Dialog adaptee;  AddrBook_Dialog_jButton2_actionAdapter(AddrBook_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}class AddrBook_Dialog_jButton3_actionAdapter implements java.awt.event.ActionListener {  AddrBook_Dialog adaptee;  AddrBook_Dialog_jButton3_actionAdapter(AddrBook_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton3_actionPerformed(e);  }}class AddrBook_Dialog_jButton4_actionAdapter implements java.awt.event.ActionListener {  AddrBook_Dialog adaptee;  AddrBook_Dialog_jButton4_actionAdapter(AddrBook_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton4_actionPerformed(e);  }}class AddrBook_Dialog_jButton5_actionAdapter implements java.awt.event.ActionListener {  AddrBook_Dialog adaptee;  AddrBook_Dialog_jButton5_actionAdapter(AddrBook_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton5_actionPerformed(e);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -