求大神~~~java代码 关于ATM的 修改密码的 在下面代码里面加就行代码不完整Java密码修改的代码 , 还有几个类
public class ATMChangePass extends JFrame {
private JPanel contentPane;
private JPasswordField txtOldPass, txtNewPass1, txtNewPass2;
private String user;
private Zhujiemian owner;
public ATMChangePass(Zhujiemian owner, String user) {
super("修改密码");
this.user=user;
this.owner=owner;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel label = new JLabel("\u8BF7\u8F93\u5165\u65E7\u5BC6\u7801");
label.setBounds(10, 43, 155, 33);
contentPane.add(label);
JLabel label_1 = new JLabel("\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801");
label_1.setBounds(10, 113, 155, 33);
contentPane.add(label_1);
JLabel label_2 = new JLabel("\u8BF7\u518D\u6B21\u8F93\u5165\u65B0\u5BC6\u7801");
label_2.setBounds(10, 179, 155, 39);
contentPane.add(label_2);
txtOldPass = new JPasswordField();
txtOldPass.setColumns(10);
txtOldPass.setBounds(214, 49, 118, 21);
contentPane.add(txtOldPass);
txtNewPass1 = new JPasswordField();
txtNewPass1.setColumns(10);
txtNewPass1.setBounds(214, 119, 118, 21);
contentPane.add(txtNewPass1);
txtNewPass2 = new JPasswordField();
txtNewPass2.setColumns(10);
txtNewPass2.setBounds(214, 188, 118, 21);
contentPane.add(txtNewPass2);
JButton button = new JButton("修改");
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
doChangePass();
}
});
button.setBounds(74, 228, 93, 23);
contentPane.add(button);
JButton button_1 = new JButton("返回");
【Java密码修改的代码 java密码修改的代码有哪些】button_1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
dispose();
ATMChangePass.this.owner.setVisible(true);
}
});
button_1.setBounds(239, 228, 93, 23);
contentPane.add(button_1);
setVisible(true);
}
private void doChangePass(){
if(txtOldPass.getText().length()6){
JOptionPane.showMessageDialog(this, "原密码不正确Java密码修改的代码!", getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
if(txtNewPass2.getText().length()6){
JOptionPane.showMessageDialog(this, "新密码不正确Java密码修改的代码!", getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
if(!txtNewPass1.getText().equals(txtNewPass2.getText())){
JOptionPane.showMessageDialog(this, "新密码不对应!", getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
JOptionPane.showMessageDialog(this, "修改成功!");
dispose();
}
public static void main(String args[])throws Exception{
new ATMChangePass(null, "user1");
}
}
请高手帮忙写一个用JAVA开发的修改密码的代码?public boolean Update(String username,ArrayList array)
{
Connection con;
Statement sql;
ResultSet rs;
boolean Flag = false;
//桥接法驱动
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try
{
//test为跟数据库关联的数据源名
con = DriverManager.getConnection("jdbc:odbc:test","","");
sql = con.createStatement();
/*假设数据库中用户表如下:
*表名:user
*各字段:
*username(用户名) password(密码) pflag(用户权限)
*
*/
rs = sql.executeQuery("select password from user where username='"+username+"'");
推荐阅读
- 市民云服务器,市民云是什么意思
- 废弃电脑怎么做成硬盘,废弃电脑的硬盘还能用吗
- 关于linux下mysql的配置文件的信息
- u盘插到打印机怎么打印,u盘插到打印机上可以直接打印吗
- go语言找兼职 golang 兼职
- 苹果ios14系统锁屏音,ios141锁屏声音
- u盘坏了怎么恢复数据,u盘坏了怎么恢复文件
- 人为什么会生病ppt,人为什么会生病ppt课件
- c语言的函数库手册 c语言 函数库