📄 customerupdateinfo.java
字号:
package customer.services.frame;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import string.logic.GetCustomer;
import MainFrame.MainFrame;
import MainFrame.MyFrame;
import customer.services.action.CustomerUpdateAction;
public class CustomerUpdateInfo extends MyFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel IDcardLabel;
private JLabel oldPassword;
private JLabel newPassword;
private JTextField oldPasswordText;
private JTextField newPasswordText;
private JButton ok;
public CustomerUpdateInfo(MainFrame m) {
super(m);
initialize(m.getTitle());
}
private void initialize(String title) {
String IDcard = new GetCustomer().getIDcard(title);
// String result = new CustomerAction().getBalance(IDcard);
IDcardLabel = new JLabel();
IDcardLabel.setText("身份证号:"+IDcard);
IDcardLabel.setFont(new Font("黑体",Font.BOLD,20));
IDcardLabel.setBounds(new Rectangle(75, 15, 200, 100));
oldPassword = new JLabel();
oldPassword.setText("输入原始密码");
oldPassword.setFont(new Font("黑体",Font.BOLD,20));
oldPassword.setBounds(new Rectangle(75, 115, 200, 100));
oldPasswordText = new JTextField();
oldPasswordText.setBounds(new Rectangle(210, 150, 100, 27));
newPassword = new JLabel();
newPassword.setText(" 输入新密码");
newPassword.setFont(new Font("黑体",Font.BOLD,20));
newPassword.setBounds(new Rectangle(75, 215, 200, 100));
newPasswordText = new JTextField();
newPasswordText.setBounds(new Rectangle(207, 250, 100, 27));
ok = new JButton();
ok.setText("确定");
//ok.setFont(new Font("黑体",Font.BOLD,20));
ok.setBounds(new Rectangle(380, 335, 100, 30));
ok.addActionListener(this);
this.add(IDcardLabel);
this.add(oldPassword);
this.add(newPassword);
this.add(oldPasswordText);
this.add(newPasswordText);
this.add(ok);
this.setTitle(title);
this.setBounds(300,200,520,390);
}
public static void main(String[] args) {
}
public void actionPerformed(ActionEvent e) {
String IDcard = new GetCustomer().getIDcard(this.getTitle());
String type = new GetCustomer().getType(this.getTitle());
String oldPassword = oldPasswordText.getText();
String newPassword = newPasswordText.getText();
System.out.println(type);
System.out.println(type);
boolean result = new CustomerUpdateAction().changePassword(oldPassword, IDcard, newPassword , type);
if(result == true){
oldPasswordText.setText("");
newPasswordText.setText("");
JOptionPane.showMessageDialog(this, "修改成功");
}else{
JOptionPane.showMessageDialog(this, "原始密码错误", "错误提示", 0);
oldPasswordText.setText("");
newPasswordText.setText("");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -