📄 rework.java
字号:
package client;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import com.swtdesigner.SwingResourceManager;
import sever.dao.LibrarianInfoDAO;
import sever.db.ConnectionDB;
import sever.entity.LibrarianInfo;
public class Rework extends JFrame{
private JFrame frame;
/**
* Launch the application
* @param args
*/
ImageIcon image=new ImageIcon("E:\\image\\1.JPG");
ImageIcon image2=new ImageIcon("E:\\image\\2.JPG");
ImageIcon image3=new ImageIcon("E:\\image\\sev.jpg");
// public static void main(String args[]) {
// try {
// Rework window = new Rework();
// window.setVisible(true);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
/**
* Create the application
*/
public Rework() {
new JFrame();
getContentPane().setLayout(null);
setBounds(190, 135, 274, 251);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle(" 修改密码");
final JPasswordField passwordField = new JPasswordField();
passwordField.setBounds(97, 65, 111, 25);
getContentPane().add(passwordField);
final JPasswordField passwordField_1 = new JPasswordField();
passwordField_1.setBounds(97, 98, 111, 25);
getContentPane().add(passwordField_1);
final JPasswordField passwordField_2 = new JPasswordField();
passwordField_2.setBounds(97, 131, 111, 25);
getContentPane().add(passwordField_2);
final JLabel label = new JLabel();
label.setFont(new Font("@黑体", Font.PLAIN, 14));
label.setText("用户名:");
label.setBounds(30, 34, 60, 15);
getContentPane().add(label);
final JTextField textField = new JTextField();
textField.setBounds(97, 31, 111, 21);
getContentPane().add(textField);
final JLabel label_1 = new JLabel();
label_1.setFont(new Font("@黑体", Font.PLAIN, 14));
label_1.setText("原密码:");
label_1.setBounds(30, 70, 60, 15);
getContentPane().add(label_1);
final JLabel label_2 = new JLabel();
label_2.setFont(new Font("@黑体", Font.PLAIN, 14));
label_2.setText("新密码:");
label_2.setBounds(30, 103, 60, 15);
getContentPane().add(label_2);
final JLabel label_3 = new JLabel();
label_3.setFont(new Font("@黑体", Font.PLAIN, 14));
label_3.setText("确认密码:");
label_3.setBounds(30, 136, 60, 15);
getContentPane().add(label_3);
final JButton button = new JButton();
button.setText("确认");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(passwordField_1.getText().length()<6){
JOptionPane.showMessageDialog(null,"密码不能少于6位!","错误", JOptionPane.ERROR_MESSAGE);
}
if(!passwordField_1.getText().equals(passwordField_2.getText())){
JOptionPane.showMessageDialog(null,"前后密码不一致","错误", JOptionPane.ERROR_MESSAGE);
}
else{
LibrarianInfo librar=new LibrarianInfo();
librar.setLibrarianPass(passwordField_2.getText().trim());
librar.setLibrarianName(textField.getText().trim());
LibrarianInfoDAO li=new LibrarianInfoDAO();
li.rework(librar);
}
}
});
button.setFont(new Font("@黑体", Font.PLAIN, 14));
button.setBounds(44, 179, 69, 25);
getContentPane().add(button);
final JButton button_1 = new JButton();
button_1.setText("重置");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
passwordField.setText("");
passwordField_1.setText("");
passwordField_2.setText("");
}
});
button_1.setFont(new Font("@黑体", Font.PLAIN, 14));
button_1.setBounds(149, 179, 69, 25);
getContentPane().add(button_1);
getContentPane().setBackground(new Color(224, 235, 237));
setIconImage(SwingResourceManager.getImage(Rework.class, "/LOGO.jpg"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -