📄 changepassword.java
字号:
package adminClient;
/**************************************************************************************
* ************************************************************************************
* 此类实现修改密码功能******************************************************************
* ***************************************by darkalex.eos******************************
*/
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@SuppressWarnings("serial")
public class ChangePassWord extends JFrame {
Icon biaoti = new ImageIcon("image/piantou2.jpg");
Icon bug11 = new ImageIcon("image/bug11.jpg");
Icon bug12 = new ImageIcon("image/bug12.jpg");
Icon bug13 = new ImageIcon("image/bug13.jpg");
Icon bug14 = new ImageIcon("image/bug14.jpg");
JButton confirm = new JButton(bug13);
JButton cancel = new JButton(bug14);
@SuppressWarnings("unused")
private JTextField adminname;
private JTextField newadminname;
@SuppressWarnings("unused")
private JPasswordField password;
private JPasswordField newpassword;
JLabel admin1;
JLabel admin2;
JLabel pass1;
JLabel pass2;
String passString = "20000101xx";
String adminString = "admin";
String s1 = "";
String s2 = "";
public ChangePassWord() {
super("更改用户名和密码");
confirm.setBorderPainted(false);
confirm.setContentAreaFilled(false);
cancel.setBorderPainted(false);
cancel.setContentAreaFilled(false);
Container container = getContentPane();
container.setLayout(new BorderLayout(10, 10));
JPanel p0 = new JPanel();
JLabel biaoti1 = new JLabel(biaoti);
p0.add(biaoti1);
container.add(p0, BorderLayout.NORTH);
JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(2, 2, 5, 5));
admin2 = new JLabel(bug11);
pass2 = new JLabel(bug12);
newadminname = new JTextField(15);
newpassword = new JPasswordField(15);
p1.add(admin2);
p1.add(newadminname);
p1.add(pass2);
p1.add(newpassword);
container.add(p1, BorderLayout.CENTER);
JPanel p2 = new JPanel();
p2.add(confirm);
p2.add(cancel);
container.add(p2, BorderLayout.SOUTH);
ChangePassWordHandler handler = new ChangePassWordHandler();
newadminname.addActionListener(handler);
newpassword.addActionListener(handler);
confirm.addActionListener(handler);
cancel.addActionListener(handler);
}
public static void main(String[] args) {
ChangePassWord cp = new ChangePassWord();
cp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cp.setSize(420, 270);
cp.setVisible(true);
}
class ChangePassWordHandler implements ActionListener {
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent event) {
if (event.getSource() == confirm) {
s1 = newadminname.getText();
s2 = newpassword.getText();
@SuppressWarnings("unused")
WriteFile wf = new WriteFile(s1, s2);
System.exit(0);
} else if (event.getSource() == cancel) {
System.exit(0);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -