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

📄 user_dialog.java

📁 stupor-record-manage-system(人事档案管理系统).
💻 JAVA
字号:
package psa;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.event.*;import com.borland.dx.sql.dataset.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class User_Dialog extends JDialog {  JPanel panel1 = new JPanel();  JLabel jLabel1 = new JLabel();  JPasswordField jPasswordField1 = new JPasswordField();  JPanel jPanel1 = new JPanel();  XYLayout xYLayout2 = new XYLayout();  JLabel jLabel2 = new JLabel();  JPasswordField jPasswordField2 = new JPasswordField();  JLabel jLabel3 = new JLabel();  JPasswordField jPasswordField3 = new JPasswordField();  JPanel jPanel2 = new JPanel();  XYLayout xYLayout3 = new XYLayout();  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  GridBagLayout gridBagLayout1 = new GridBagLayout();  Database database1 = new Database();  QueryDataSet queryDataSet_User = new QueryDataSet();  public User_Dialog(Frame frame, String title, boolean modal) {    super(frame, title, modal);    try {      jbInit();      pack();    }    catch(Exception ex) {      ex.printStackTrace();    }  }  public User_Dialog() {    this(null, "", false);  }  private void jbInit() throws Exception {    panel1.setLayout(gridBagLayout1);    jLabel1.setFont(new java.awt.Font("DialogInput", 0, 12));    jLabel1.setText("旧口令:");    jPanel1.setBorder(BorderFactory.createEtchedBorder());    jPanel1.setLayout(xYLayout2);    jLabel2.setText("新口令:");    jLabel2.setFont(new java.awt.Font("DialogInput", 0, 12));    jLabel2.setRequestFocusEnabled(true);    jLabel3.setFont(new java.awt.Font("DialogInput", 0, 12));    jLabel3.setText("确  认:");    jPanel2.setBorder(BorderFactory.createEtchedBorder());    jPanel2.setLayout(xYLayout3);    jPasswordField1.setText("");    jPasswordField2.setText("");    this.setResizable(false);    this.setTitle("口令维护");    jButton1.setFont(new java.awt.Font("DialogInput", 0, 12));    jButton1.setText("确认");    jButton1.addActionListener(new User_Dialog_jButton1_actionAdapter(this));    jButton2.setFont(new java.awt.Font("DialogInput", 0, 12));    jButton2.setText("取消");    jButton2.addActionListener(new User_Dialog_jButton2_actionAdapter(this));    database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:psa", "", "", false, "sun.jdbc.odbc.JdbcOdbcDriver"));    database1.setDatabaseName("");    getContentPane().add(panel1);    jPanel1.add(jPasswordField2, new XYConstraints(115, 14, 143, -1));    jPanel1.add(jLabel3, new XYConstraints(22, 51, -1, -1));    jPanel1.add(jLabel2, new XYConstraints(22, 15, -1, -1));    jPanel1.add(jPasswordField3, new XYConstraints(115, 48, 143, -1));    panel1.add(jButton2,  new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(24, 73, 24, 94), 0, 0));    panel1.add(jButton1,  new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(23, 104, 24, 0), 0, 0));    panel1.add(jPanel2,  new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(31, 48, 0, 51), 28, 13));    jPanel2.add(jLabel1,  new XYConstraints(24, 18, -1, -1));    jPanel2.add(jPasswordField1,  new XYConstraints(113, 17, 143, -1));    panel1.add(jPanel1,  new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 48, 0, 51), 26, 15));  }  void jButton2_actionPerformed(ActionEvent e) {    this.dispose();  }  void jButton1_actionPerformed(ActionEvent e) {    if(jPasswordField2.getText().length()==0)    {      JOptionPane.showMessageDialog(this,"新口令不能为空!请重新输入!","提示",JOptionPane.INFORMATION_MESSAGE);      return;    }    if(!jPasswordField2.getText().equals(jPasswordField3.getText()))    {      JOptionPane.showMessageDialog(this,"您输入的新口令和确认口令不一致,请重新输入","提示",JOptionPane.INFORMATION_MESSAGE);      jPasswordField2.setText("");      jPasswordField3.setText("");      return;    }    queryDataSet_User.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "SELECT * from User where Name =\'admin\' and Pass = \'"      +jPasswordField1.getText()+"\'", null, true, Load.ALL));    try{      queryDataSet_User.open();    }catch(Exception ex)    {      return;    }    if(queryDataSet_User.getRowCount()==0)    {      queryDataSet_User.close();      JOptionPane.showMessageDialog(this,"您输入的口令不正确!请重新输入!","提示",JOptionPane.ERROR_MESSAGE);      jPasswordField1.setText("");      return;    }else{          try{            queryDataSet_User.editRow();           // queryDataSet_User.setString("name",jTextField1.getText());            queryDataSet_User.setString("pass",jPasswordField2.getText());            queryDataSet_User.post();            queryDataSet_User.saveChanges();            queryDataSet_User.close();            JOptionPane.showMessageDialog(this,"修改口令成功!请记住新口令","提示",JOptionPane.INFORMATION_MESSAGE);          }catch(Exception ex)          {            JOptionPane.showMessageDialog(this,"修改口令失败!","提示",JOptionPane.ERROR_MESSAGE);            queryDataSet_User.refresh();            return;          }          this.dispose();    }  }}class User_Dialog_jButton2_actionAdapter implements java.awt.event.ActionListener {  User_Dialog adaptee;  User_Dialog_jButton2_actionAdapter(User_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton2_actionPerformed(e);  }}class User_Dialog_jButton1_actionAdapter implements java.awt.event.ActionListener {  User_Dialog adaptee;  User_Dialog_jButton1_actionAdapter(User_Dialog adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jButton1_actionPerformed(e);  }}

⌨️ 快捷键说明

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