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

📄 reader_dialog.java

📁 library-manage-system(图书管理系统),很好的学习源码。
💻 JAVA
字号:
package library;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import com.borland.dbswing.*;import java.awt.event.*;import com.borland.dx.sql.dataset.*;import com.borland.dx.dataset.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class Reader_Dialog extends JDialog {  private JPanel panel1 = new JPanel();  private JTextField jTextField1 = new JTextField();  private JButton jButton1 = new JButton();  private GridBagLayout gridBagLayout1 = new GridBagLayout();  private JLabel jLabel2 = new JLabel();  private JLabel jLabel1 = new JLabel();  private Database database1 = new Database();  private QueryDataSet queryDataSet1 = new QueryDataSet();  private Column column1 = new Column();  private TableScrollPane tableScrollPane1 = new TableScrollPane();  private JdbTable jdbTable1 = new JdbTable();  private JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();  private GridBagLayout gridBagLayout2 = new GridBagLayout();  public Reader_Dialog(Frame frame, String title, boolean modal) {    super(frame, title, modal);    try {      jbInit();      pack();    }    catch(Exception ex) {      ex.printStackTrace();    }  }  public Reader_Dialog() {    this(null, "", false);  }  private void jbInit() throws Exception {    panel1.setLayout(gridBagLayout2);    jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {      public void keyReleased(KeyEvent e) {        jTextField1_keyReleased(e);      }    });    jButton1.setFont(new java.awt.Font("DialogInput", 0, 12));    jButton1.setText("返回");    jButton1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(ActionEvent e) {        jButton1_actionPerformed(e);      }    });    jLabel2.setFont(new java.awt.Font("DialogInput", 0, 12));    jLabel2.setText("例如:001");    jLabel1.setFont(new java.awt.Font("DialogInput", 0, 12));    jLabel1.setText("读者编号:");    database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:lib", "", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));    queryDataSet1.setMetaDataUpdate(MetaDataUpdate.NONE);    queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select code as 编号,name as 姓名,sex as 性别 ,type as 类型 ,dept as 部门 ,phone " +      "as 电话 ,address as 地址 from readerInfo ", null, true, Load.ALL));    column1.setColumnName("编号");    column1.setDataType(com.borland.dx.dataset.Variant.STRING);    column1.setPrecision(15);    column1.setRowId(true);    column1.setServerColumnName("编号");    column1.setSqlType(12);    queryDataSet1.setColumns(new Column[] {column1});    jdbTable1.setDataSet(queryDataSet1);    jdbNavToolBar1.setBorder(BorderFactory.createEtchedBorder());    jdbNavToolBar1.setToolTipText("");    jdbNavToolBar1.setButtonStateSave(JdbNavToolBar.HIDDEN);    jdbNavToolBar1.setButtonStateRefresh(JdbNavToolBar.HIDDEN);    jdbNavToolBar1.setDataSet(queryDataSet1);    this.setTitle("读者管理");    getContentPane().add(panel1);    panel1.add(tableScrollPane1,  new GridBagConstraints(0, 1, 4, 1, 1.0, 1.0            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(21, 22, 0, 19), 269, -166));    panel1.add(jLabel1,  new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(41, 36, 0, 0), 0, 0));    panel1.add(jTextField1,  new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(41, 19, 0, 0), 108, 0));    panel1.add(jLabel2,  new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(41, 50, 0, 212), 0, 0));    panel1.add(jdbNavToolBar1,  new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(26, 23, 25, 0), 66, 0));    panel1.add(jButton1,  new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(33, 107, 32, 70), 0, 0));    tableScrollPane1.getViewport().add(jdbTable1, null);  }  void jTextField1_keyReleased(KeyEvent e) {    if(queryDataSet1.isOpen()) queryDataSet1.close();    if(jTextField1.getText().length()==0)      queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select code as 编号,name as 姓名,sex as 性别 ,type as 类型 ,dept as 部门 ,phone " +                "as 电话  ,address as 地址 from readerInfo ", null, true, Load.ALL));    else      queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select code as 编号,name as 姓名,sex as 性别 ,type as 类型 ,dept as 部门 ,phone " +                "as 电话  ,address as 地址 from readerInfo  where code = \'"+jTextField1.getText() +"\'", null, true, Load.ALL));    queryDataSet1.open();  }  void jButton1_actionPerformed(ActionEvent e) {    this.dispose();  }}

⌨️ 快捷键说明

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