📄 xiummframe1.java
字号:
package student;
import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class xiuMMFrame1 extends JFrame {
public xiuMMFrame1() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
jLabel1.setText("原始密码");
jLabel1.setBounds(new Rectangle(39, 48, 100, 46));
jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
jLabel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
jButton1.setBounds(new Rectangle(64, 229, 115, 34));
jButton1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
jButton1.setText("确定");
jButton1.addActionListener(new xiuMMFrame1_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(196, 228, 116, 35));
jButton2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
jButton2.setText("取消");
jButton2.addActionListener(new xiuMMFrame1_jButton2_actionAdapter(this));
mm1.setBounds(new Rectangle(131, 107, 170, 32));
mm2.setText("");
mm2.setBounds(new Rectangle(130, 166, 170, 32));
cs.setText("");
cs.setBounds(new Rectangle(130, 57, 170, 33));
this.getContentPane().setBackground(Color.white);
jLabel4.setText("jLabel4");
jLabel4.setBounds(new Rectangle( -2, 3, 400, 295));
this.getContentPane().add(jLabel1);
jLabel3.setText("确认密码");
jLabel3.setBounds(new Rectangle(36, 158, 101, 46));
this.getContentPane().add(jLabel3);
this.getContentPane().add(jButton1);
this.getContentPane().add(jButton2);
this.getContentPane().add(jLabel2);
this.getContentPane().add(cs);
this.getContentPane().add(mm1);
this.getContentPane().add(mm2);
this.getContentPane().add(jLabel4);
jLabel2.setText("修改密码");
jLabel2.setBounds(new Rectangle(35, 98, 104, 46));
jButton1.setIcon(new ImageIcon("an086.gif"));
jButton2.setIcon(new ImageIcon("an088.gif"));
jLabel4.setIcon(new ImageIcon("11.jpg"));
}
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JPasswordField mm1 = new JPasswordField();
JPasswordField mm2 = new JPasswordField();
JPasswordField cs = new JPasswordField();
JLabel jLabel4 = new JLabel();
public void jButton1_actionPerformed(ActionEvent e) {
String CS=(new String(cs.getPassword()));
String MM1=(new String(mm1.getPassword()));
String MM2=(new String(mm2.getPassword()));
if(CS.equals("")){
JOptionPane.showMessageDialog(this,"初始密码不能会空");
return;
}
if(MM1.equals("")){
JOptionPane.showMessageDialog(this,"设置密码不能会空");
cs.setText("");
mm1.setText("");
mm2.setText("");
return;
}
if(MM2.equals("")){
JOptionPane.showMessageDialog(this,"请再次输入密码");
cs.setText("");
mm1.setText("");
mm2.setText("");
return;
}
if(MM1.equals(MM2)){
}else{
JOptionPane.showMessageDialog(this,"请输入相同的密码");
cs.setText("");
mm1.setText("");
mm2.setText("");
return;
}
try{
Connectionsql s=new Connectionsql();
Connection con=s.getConnection();
Statement stmt=con.createStatement();
dengluFrame1 ss=new dengluFrame1();
String sql="select mima from zhanghu where zhanghao like '"+ss.name+"' ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
if(rs.getString(1).equals(CS)){
stmt.executeUpdate("update zhanghu set mima='"+MM1+"' where zhanghao like '"+ss.name+"'");
JOptionPane.showMessageDialog(this,"密码修改成功");
cs.setText("");
mm1.setText("");
mm2.setText("");
}else{
JOptionPane.showMessageDialog(this,"您输入的原始密码错误!");
cs.setText("");
mm1.setText("");
mm2.setText("");
return;
}
}
con.close();
stmt.close();
rs.close();
}catch(Exception xx){
xx.printStackTrace();
}
}
public void jTextField1_actionPerformed(ActionEvent e) {
}
public void jButton2_actionPerformed(ActionEvent e) {
this.dispose();
}
}
class xiuMMFrame1_jButton2_actionAdapter implements ActionListener {
private xiuMMFrame1 adaptee;
xiuMMFrame1_jButton2_actionAdapter(xiuMMFrame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class xiuMMFrame1_jTextField1_actionAdapter implements ActionListener {
private xiuMMFrame1 adaptee;
xiuMMFrame1_jTextField1_actionAdapter(xiuMMFrame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jTextField1_actionPerformed(e);
}
}
class xiuMMFrame1_jButton1_actionAdapter implements ActionListener {
private xiuMMFrame1 adaptee;
xiuMMFrame1_jButton1_actionAdapter(xiuMMFrame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -