📄 customertransfer.java
字号:
package customer.services.frame;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import string.logic.GetCustomer;
import DBManager.SQLserver2000;
import MainFrame.MainFrame;
import MainFrame.MyFrame;
import customer.services.action.CustomerAction;
public class CustomerTransfer extends MyFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel username;
private JLabel toUsername;
private JTextField toUsernameText;
private JLabel money;
private JLabel toMoney;
private JTextField toMoneyText;
private JButton ok;
public CustomerTransfer(MainFrame m) {
super(m);
initialize(m.getTitle());
}
private void initialize(String title) {
username = new JLabel();
username.setText("身份证号:"+new GetCustomer().getIDcard(title));
username.setFont(new Font("黑体",Font.BOLD,20));
username.setBounds(new Rectangle(115, 15, 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, 55, 200, 100));
toUsername = new JLabel();
toUsername.setText("对方身份证号:");
toUsername.setFont(new Font("黑体",Font.BOLD,20));
toUsername.setBounds(new Rectangle(115, 95, 200, 100));
toUsernameText = new JTextField();
toUsernameText.setBounds(new Rectangle(255, 135, 150, 27));
toMoney = new JLabel();
toMoney.setText("转账金额:");
toMoney.setFont(new Font("黑体",Font.BOLD,20));
toMoney.setBounds(new Rectangle(115, 135, 200, 100));
toMoneyText = new JTextField();
toMoneyText.setBounds(new Rectangle(255, 175, 150, 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(username);
this.add(money);
this.add(toUsername);
this.add(toUsernameText);
this.add(toMoney);
this.add(toMoneyText);
this.add(ok);
this.setTitle(title);
this.setBounds(300,200,520,390);
}
public boolean check(String str){
if(str.startsWith("0")){
JOptionPane.showMessageDialog(this, "不能以0开始");
toMoneyText.selectAll();
toMoneyText.requestFocus();
}
Matcher matcher = Pattern.compile("^[0-9]{1,6}$").matcher(str);
return matcher.matches();
}
public static void main(String[] args) {
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == ok){
}
if(m!=null)
m.setVisible(true);
dispose();
SQLserver2000.closeDB();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -