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

📄 userpasswordfrm.java~2~

📁 JAVA编写的登陆窗体
💻 JAVA~2~
字号:
package loginexample;

import java.awt.*;

import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class userpasswordfrm extends JFrame {
    public userpasswordfrm() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        getContentPane().setLayout(null);
        jLabel1.setText("用户名:");
        jLabel1.setBounds(new Rectangle(40, 58, 77, 27));
        jLabel4.setText("确认密码:");
        jLabel4.setBounds(new Rectangle(40, 227, 95, 27));
        jPasswordField2.setBounds(new Rectangle(161, 177, 128, 35));
        jPasswordField1.setBounds(new Rectangle(161, 110, 127, 35));
        jLabel3.setText("新密码:");
        jLabel3.setBounds(new Rectangle(49, 183, 77, 27));
        jLabel2.setText("原始密码:");
        jLabel2.setBounds(new Rectangle(40, 124, 97, 27));
        this.getContentPane().add(jTextField1);
        jButton2.setBounds(new Rectangle(218, 286, 123, 37));
        jButton2.setText("取消");
        jButton1.setBounds(new Rectangle(86, 286, 123, 37));
        jButton1.setText("确定");
        jButton1.addActionListener(new userpasswordfrm_jButton1_actionAdapter(this));
        jPasswordField3.setBounds(new Rectangle(160, 221, 129, 35));
        this.getContentPane().add(jLabel2);
        this.getContentPane().add(jLabel3);
        this.getContentPane().add(jPasswordField2);
        this.getContentPane().add(jLabel4);
        this.getContentPane().add(jLabel1);
        this.getContentPane().add(jPasswordField3);
        this.getContentPane().add(jButton1);
        this.getContentPane().add(jButton2);
        this.getContentPane().add(jPasswordField1);
        jTextField1.setBounds(new Rectangle(162, 56, 127, 33));
    }

    JLabel jLabel1 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JPasswordField jPasswordField1 = new JPasswordField();
    JPasswordField jPasswordField2 = new JPasswordField();
    JLabel jLabel4 = new JLabel();
    JPasswordField jPasswordField3 = new JPasswordField();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    DBCON db=new DBCON();
    public void jButton1_actionPerformed(ActionEvent e) {
        String strname = jTextField1.getText().trim();
        char ch[] = jPasswordField1.getPassword();
        String stroldpass = new String(ch);
        char ch1[] = jPasswordField2.getPassword();
        String strnewpass = new String(ch1);
        char ch2[] = jPasswordField3.getPassword();
        String strnewpass1 = new String(ch2);
        if (strnewpass.equals(strnewpass1)) {
           boolean b=db.updateuser(strnewpass,strname,stroldpass) ;
           if(b==true)
           {
               JOptionPane.showMessageDialog(this,"修改成功!");

           }
           else{
               JOptionPane.showMessageDialog(this,"修改失败!");

           }
        }
        else
        {
            JOptionPane.showMessageDialog(this,"密码不一致!");

        }

    }
}


class userpasswordfrm_jButton1_actionAdapter implements ActionListener {
    private userpasswordfrm adaptee;
    userpasswordfrm_jButton1_actionAdapter(userpasswordfrm adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

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