📄 customerremove.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 string.logic.GetCustomer;
import DBManager.SQLserver2000;
import MainFrame.MainFrame;
import MainFrame.MyFrame;
import customer.services.action.CustomerAction;
import customer.services.action.CustomerUpdateAction;
public class CustomerRemove extends MyFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel CustomerMessage;
private JLabel username;
private JLabel money;
private JButton ok;
private MainFrame frame;
public CustomerRemove(MainFrame m) {
super(m);
frame = m;
initialize(m.getTitle());
}
private void initialize(String title) {
CustomerMessage = new JLabel();
CustomerMessage.setText("以下是你的个人信息");
CustomerMessage.setFont(new Font("黑体",Font.BOLD,20));
CustomerMessage.setBounds(new Rectangle(115, 15, 200, 100));
username = new JLabel();
username.setText("身份证号:"+new GetCustomer().getIDcard(title));
username.setFont(new Font("黑体",Font.BOLD,20));
username.setBounds(new Rectangle(115, 45, 200, 100));
String IDcard = new GetCustomer().getIDcard(title);
String result = new CustomerAction().getBalance(IDcard);
money = new JLabel();
money.setText("余额:"+result);
money.setFont(new Font("黑体",Font.BOLD,20));
money.setBounds(new Rectangle(115, 155, 200, 100));
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(CustomerMessage);
this.add(username);
this.add(money);
this.add(ok);
this.setTitle(title);
this.setBounds(300,200,520,390);
}
public static void main(String[] args) {
}
public void actionPerformed(ActionEvent e) {
int removeMoney = Integer.parseInt(money.getText().substring(money.getText().indexOf(":")+1,money.getText().length()));
System.out.println(removeMoney);
if(removeMoney>0){
JOptionPane.showMessageDialog(this, "账户还有钱,不能注销");
return;
}
int confirm = JOptionPane.showConfirmDialog(this, "确定注销", "注销确认", 0);
if(confirm == 0){
String IDcard = new GetCustomer().getIDcard(this.getTitle());
String type = new GetCustomer().getType(this.getTitle());
boolean result = new CustomerUpdateAction().removeCustomer(IDcard, type);
if(result == true ){
JOptionPane.showMessageDialog(this, "注销成功!");
}
frame.setEnable("");
frame.setTitle("信用卡管理系统");
frame.setVisible(true);
this.dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -