package com.shao.iframe;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import com.shao.DAO.ExecuteSQL;
public class transferFrame extends JFrame {
private JPanel contentPane;
private JTextField out_nameField;
private JTextField out_moneyField;
//private com.shao.model.user user;
private com.shao.model.user user_query_deposit;
private com.shao.model.user user_modMoney_deposit;
private com.shao.model.user user_query_withdraw;
private com.shao.model.user user_modMoney_withdraw;
/**
* Create the frame.
*/
public transferFrame(final String name) {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 527, 358);
setTitle(name);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("\u8F6C\u8D26\u7528\u6237\u540D\uFF1A");
lblNewLabel.setFont(new Font("新宋体", Font.BOLD, 20));
lblNewLabel.setBounds(105, 72, 126, 30);
contentPane.add(lblNewLabel);
out_nameField = new JTextField();
out_nameField.setBounds(245, 77, 150, 24);
contentPane.add(out_nameField);
out_nameField.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("\u8F6C\u8D26\u91D1\u989D\uFF1A");
lblNewLabel_1.setFont(new Font("新宋体", Font.BOLD, 20));
lblNewLabel_1.setBounds(105, 141, 112, 30);
contentPane.add(lblNewLabel_1);
out_moneyField = new JTextField();
out_moneyField.setBounds(243, 146, 152, 24);
contentPane.add(out_moneyField);
out_moneyField.setColumns(10);
JButton OKButton = new JButton("\u786E\u8BA4");
OKButton.setFont(new Font("新宋体", Font.BOLD, 17));
OKButton.setBounds(104, 225, 113, 27);
contentPane.add(OKButton);
OKButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int res = JOptionPane.showConfirmDialog(null, "确认此次转账?", "转账确认", JOptionPane.YES_NO_OPTION);
if (res == JOptionPane.YES_OPTION) {
user_query_deposit = ExecuteSQL.query(out_nameField.getText());//转出钱
if (out_nameField.getText().equals(user_query_deposit.getName())) {
if (Float.parseFloat(out_moneyField.getText()) < 100000) {
if(Float.parseFloat(out_moneyField.getText())%100==0) {
user_query_withdraw = ExecuteSQL.query(name);
// user_1 = ExecuteSQL.query(out_nameField);
if (user_query_withdraw.getbalance() > Double.parseDouble(out_moneyField.getText())) {
double temp = user_query_withdraw.getbalance() - Double.parseDouble(out_moneyField.getText());
double temp_1 = user_query_deposit.getbalance() + Double.parseDouble(out_moneyField.getText());
DecimalFormat df = new DecimalFormat("0.00 ");
int i_withdraw = ExecuteSQL.modifyMoney(name, temp);
int i_deposit = ExecuteSQL.modifyMoney(out_nameField.getText(), temp_1);
if(i_withdraw>0 && i_deposit>0){
setVisible(false);
atmFrame frame = new atmFrame(name);
frame.setVisible(true);
JOptionPane.showMessageDialog(null, "转账交易成功!" + "\n" + "剩余余额为:" + df.format(temp));
}else{
JOptionPane.showMessageDialog(null, "转账交易失败!" + "\n" + "剩余余额为:" + df.format(temp));
}
} else {
JOptionPane.showMessageDialog(null,
"余额不足,请重新输入!" + "\n" + "当前余额为:" + user_query_withdraw.getbalance());
out_moneyField.setText("");
}
}else {
JOptionPane.showMessageDialog(null, "输入金额大于1000000,请重新输入!");
out_moneyField.setText("");
}
} else {
JOptionPane.showMessageDialog(null, "转账金额必须10000,请重新输入!");
out_moneyField.setText("");
}
} else {
JOptionPane.showMessageDialog(null, "找不到该转账用户!");
out_nameField.setText("");
}
} else {
return;
}
}
});
JButton backButton_1 = new JButton("\u8FD4\u56DE");
backButton_1.setFont(new Font("新宋体", Font.BOLD, 18));
backButton_1.setBounds(282, 225, 113, 27);
contentPane.add(backButton_1);
backButton_1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
atmFrame af = new atmFrame(name);
setVisible(false);
af.setVisible(true);
}
});
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ATM_MySql.zip (35个子文件)
ATM_MySql
imame
atm.sql 984B
bin
com
shao
model
user.class 923B
iframe
withdrawFrame$2.class 945B
LoginFrame$signAction.class 825B
SignFrame$OKButtonAction.class 2KB
transferFrame$1.class 3KB
SignFrame.class 3KB
depositFrame$1.class 3KB
depositFrame$2.class 939B
atmFrame$5.class 925B
transferFrame$2.class 945B
withdrawFrame.class 3KB
LoginFrame$1.class 761B
transferFrame.class 3KB
depositFrame.class 3KB
LoginFrame.class 3KB
atmFrame$2.class 2KB
atmFrame$3.class 923B
LoginFrame$loginAction.class 2KB
atmFrame$1.class 781B
withdrawFrame$1.class 3KB
atmFrame.class 2KB
atmFrame$4.class 925B
DAO
ExecuteSQL.class 4KB
.settings
org.eclipse.jdt.core.prefs 598B
src
com
shao
model
user.java 549B
iframe
withdrawFrame.java 4KB
LoginFrame.java 4KB
atmFrame.java 3KB
depositFrame.java 3KB
SignFrame.java 3KB
transferFrame.java 5KB
DAO
ExecuteSQL.java 3KB
.project 385B
.classpath 552B
共 35 条
- 1
资源评论
- java毕业2022-06-25用户下载后在一定时间内未进行评价,系统默认好评。
qq1334611189
- 粉丝: 6993
- 资源: 399
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功