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

📄 modifypassworddialog.java~14~

📁 JAVA+SQL2000 网吧上下机管理
💻 JAVA~14~
字号:
package netbar;

import java.awt.*;

import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.BorderFactory;
import java.awt.BorderLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class modifypasswordDialog extends JDialog {
    JPanel panel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    JLabel jLabel1 = new JLabel();
    JLabel jLabelname = new JLabel();
    JLabel jLabel2 = new JLabel();
    JPasswordField jPasswordold = new JPasswordField();
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JPasswordField jPasswordnew1 = new JPasswordField();
    JPasswordField jPasswordnew2 = new JPasswordField();
    JLabel jLabeltitle = new JLabel();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JLabel jLabel6 = new JLabel();
    public modifypasswordDialog(Frame owner, String title, boolean modal) {
        super(owner, title, modal);
        try {
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            jbInit();
            pack();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    public modifypasswordDialog() {
        this(new Frame(), "modifypasswordDialog", false);
    }

    private void jbInit() throws Exception {
        panel1.setLayout(xYLayout1);
        jLabel1.setBorder(null);
        jLabel1.setText("当 前 用 户:");
        jLabel2.setText("请输入旧密码:");
        jLabel3.setText("请输入新密码:");
        jLabel4.setText("重新输入新密码:");
        jLabeltitle.setForeground(SystemColor.scrollbar);
        jLabeltitle.setBorder(BorderFactory.createTitledBorder ("更改密码:"));
        jButton1.setText("更改");
        jButton1.addMouseListener(new
                                  modifypasswordDialog_jButton1_mouseAdapter(this));
        jButton2.setText("取消");
        jButton2.addMouseListener(new
                                  modifypasswordDialog_jButton2_mouseAdapter(this));
        setSize(new Dimension(274, 296));
        jLabelname.setForeground(Color.red);
        panel1.add(jButton1, new XYConstraints(56, 248, 64, 25));
        panel1.add(jButton2, new XYConstraints(150, 248, 63, 26));
        panel1.add(jLabel3, new XYConstraints(32, 123, 90, 21));
        panel1.add(jLabel2, new XYConstraints(30, 76, 90, 22));
        panel1.add(jPasswordold, new XYConstraints(127, 81, 105, 16));
        panel1.add(jPasswordnew1, new XYConstraints(127, 125, 105, 14));
        panel1.add(jLabel4, new XYConstraints(32, 166, 96, 22));
        panel1.add(jPasswordnew2, new XYConstraints(127, 167, 104, 17));
        panel1.add(jLabelname, new XYConstraints(127, 48, 114, 18));
        panel1.add(jLabel1, new XYConstraints(33, 45, 81, 21));
        panel1.add(jLabeltitle, new XYConstraints(7, 19, 253, 221));
        this.getContentPane().add(panel1, java.awt.BorderLayout.CENTER);
    }

    public void jButton2_mouseClicked(MouseEvent e) {
        if(e.getButton()==e.BUTTON1){
            this.dispose();
        }
    }

    public void jButton1_mouseClicked(MouseEvent e) {
        if(e.getButton()==e.BUTTON1){
            connectSQL con=new connectSQL();
            String pwd=con.getPassword(jLabelname.getText().toString());
            char[] cpwdold=jPasswordold.getPassword();
            String pwdold=String.valueOf(cpwdold);
            char[] cpwdnew1=jPasswordold.getPassword();
            String pwdnew1=String.valueOf(cpwdnew1);
            char[] cpwdnew2=jPasswordold.getPassword();
            String pwdnew2=String.valueOf(cpwdnew2);
            if(pwd.equals(pwdold) && pwdnew1.equals(pwdnew2)){
                 if(con.modifyPassword(jLabelname.getText().toString(),pwdnew1)){
                     this.dispose();
//                  JOptionPane.showMessageDialog(null,"修改成功!");
                }else{
                  JOptionPane.showMessageDialog(null,"密码错误,请重试!");
                }
            }
        }
    }
}


class modifypasswordDialog_jButton1_mouseAdapter extends MouseAdapter {
    private modifypasswordDialog adaptee;
    modifypasswordDialog_jButton1_mouseAdapter(modifypasswordDialog adaptee) {
        this.adaptee = adaptee;
    }

    public void mouseClicked(MouseEvent e) {
        adaptee.jButton1_mouseClicked(e);
    }
}


class modifypasswordDialog_jButton2_mouseAdapter extends MouseAdapter {
    private modifypasswordDialog adaptee;
    modifypasswordDialog_jButton2_mouseAdapter(modifypasswordDialog adaptee) {
        this.adaptee = adaptee;
    }

    public void mouseClicked(MouseEvent e) {
        adaptee.jButton2_mouseClicked(e);
    }
}

⌨️ 快捷键说明

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