/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package MainForm;
/**
*
* @author Linux
*/
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import java.awt.event.*;
import login.Login;
import user.userBean;
public class inputMoney extends JFrame implements ActionListener{
Container contentPane;
JPanel centerPanel=new JPanel();
JPanel centerdownPanel=new JPanel();
JPanel eastPanel=new JPanel();
JPanel westPanel=new JPanel();
JPanel downPanel=new JPanel();
Dimension facesize=new Dimension(800,500);
JLabel jLabel=new JLabel();
JLabel jLabel1=new JLabel();
JLabel jLabel2=new JLabel();
JLabel jLabel3=new JLabel();
JLabel jLabel4=new JLabel();
JTextField Jtf=new JTextField();
JButton input100=new JButton();
JButton input200=new JButton();
JButton input500=new JButton();
JButton input1000=new JButton();
JButton reset=new JButton();
JButton confirm=new JButton();
JButton goback=new JButton();
JButton exit=new JButton();
GridBagLayout gridBag=new GridBagLayout();
GridBagConstraints gridBagCon;
public inputMoney(){
this.setSize(facesize);
this.setResizable(false);
this.setTitle("存款页");
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((screenSize.width-400)/2, (screenSize.height-300)/2+45);
try{
Init();
}catch(Exception e){
e.printStackTrace();
}
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void Init()throws Exception{
contentPane=this.getContentPane();
contentPane.setLayout(new BorderLayout());
centerPanel.setLayout(gridBag);
jLabel.setText("请选择存款额:");
jLabel.setFont(new Font("Dialog",0,12));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=0;
gridBagCon.insets=new Insets(10,15,10,1);
gridBag.setConstraints(jLabel, gridBagCon);
centerPanel.add(jLabel);
Jtf.setText("整数存款额");
Jtf.setEditable(false);
Jtf.setBackground(Color.gray);
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=1;
gridBagCon.gridy=0;
gridBagCon.insets=new Insets(10,1,10,10);
gridBag.setConstraints(Jtf, gridBagCon);
centerPanel.add(Jtf);
westPanel.setLayout(gridBag);
input100.setText("10");
input100.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=0;
gridBagCon.insets=new Insets(10,10,10,1);
gridBag.setConstraints(input100, gridBagCon);
westPanel.add(input100);
jLabel2.setText(" ");
jLabel2.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=1;
gridBagCon.insets=new Insets(10,10,10,1);
gridBag.setConstraints(jLabel2, gridBagCon);
westPanel.add(jLabel2);
input500.setText("20");
input500.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=2;
gridBagCon.insets=new Insets(10,15,10,1);
gridBag.setConstraints(input500, gridBagCon);
westPanel.add(input500);
jLabel3.setText(" ");
jLabel3.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=3;
gridBagCon.insets=new Insets(10,10,10,1);
gridBag.setConstraints(jLabel3, gridBagCon);
westPanel.add(jLabel3);
goback.setText("返回");
goback.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=4;
gridBagCon.insets=new Insets(10,15,10,10);
gridBag.setConstraints(goback, gridBagCon);
westPanel.add(goback);
eastPanel.setLayout(gridBag);
input200.setText("50");
input200.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=0;
gridBagCon.insets=new Insets(10,10,10,1);
gridBag.setConstraints(input200,gridBagCon);
eastPanel.add(input200);
jLabel1.setText(" ");
jLabel1.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=1;
gridBagCon.insets=new Insets(10,10,10,1);
gridBag.setConstraints(jLabel1, gridBagCon);
eastPanel.add(jLabel1);
input1000.setText("100");
input1000.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=2;
gridBagCon.insets=new Insets(10,15,10,1);
gridBag.setConstraints(input1000,gridBagCon);
eastPanel.add(input1000);
jLabel4.setText(" ");
jLabel4.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=3;
gridBagCon.insets=new Insets(10,10,10,1);
gridBag.setConstraints(jLabel4, gridBagCon);
eastPanel.add(jLabel4);
exit.setText("退出");
exit.setFont(new Font("Dialog",0,15));
gridBagCon=new GridBagConstraints();
gridBagCon.gridx=0;
gridBagCon.gridy=4;
gridBagCon.insets=new Insets(10,15,10,1);
gridBag.setConstraints(exit, gridBagCon);
eastPanel.add(exit);
contentPane.add(centerPanel,BorderLayout.CENTER);
contentPane.add(eastPanel,BorderLayout.EAST);
contentPane.add(westPanel,BorderLayout.WEST);
goback.addActionListener(this);
exit.addActionListener(this);
input100.addActionListener(this);
input200.addActionListener(this);
input500.addActionListener(this);
input1000.addActionListener(this);
}
public void downInit()throws Exception{
confirm.setText("确定");
confirm.setFont(new Font("Dialog",0,12));
downPanel.add(confirm);
reset.setText("重置");
reset.setFont(new Font("Dialog",0,12));
downPanel.add(reset);
contentPane.add(downPanel,BorderLayout.SOUTH);
confirm.addActionListener(this);
reset.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
Object obj=e.getSource();
String srm;
int rest;
int rm;
if(obj==input100){
Jtf.setText("10");
}else if(obj==input200){
Jtf.setText("50");
}else if(obj==input500){
Jtf.setText("20");
}else if(obj==input1000){
Jtf.setText("100");
}else if(obj==goback){
this.dispose();
mainForm mf=new mainForm();
try {
mf.downInit();
mf.pack();
mf.setVisible(true);
} catch (Exception ex) {
Logger.getLogger(getMoney.class.getName()).log(Level.SEVERE, null, ex);
}
}else if(obj==exit){
this.dispose();
}else if(obj==confirm){
if(Jtf.getText()==null||Jtf.getText().equals("")){
JOptionPane.showMessageDialog(null,"请输入您的存款额!");
}
else
{
userBean ub=new userBean();
rest=ub.search(Login.username);
rm=Integer.parseInt(Jtf.getText())+rest;
if(rm>0&&rm<65500){
ub.inputMoney(Login.username,rm);
JOptionPane.showMessageDialog(null,
简单的用Java实现的ATM取款系统
需积分: 12 197 浏览量
2009-07-28
20:09:16
上传
评论 2
收藏 222KB RAR 举报
守仁
- 粉丝: 59
- 资源: 7
最新资源
- React项目基于JavaScript实现的全球新闻发布管理系统源码.zip
- 基于keras+fasterRCNN,在VOC格式的口罩数据集上训练,检测人群中有无戴口罩python源码+模型
- 基于opencv+qt5机器视觉的传统缺陷检测, 即采用标准图片和待测图片进行pixel to pixel的XOR操作源码+文档
- 管道内检测缺陷数据库管理系统源码+文档说明+sln
- 毕业设计-低功耗STM32F411开发板(原理图+PCB源文件+官方例程+驱动等)源码+文档说明+截图
- 基于yolov5-tensorRT检测+发动机缸体内壁缺陷检测系统源码+文档说明
- 基于C++实现的锂电池缺陷检测源码+文档说明
- push_version
- 软件自制图像批量压缩工具
- 经典缺陷检测算法源码整理包含PaDiM(2020ICPR)、PatchCore(2022CVPR)、SimpleNet+文档说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈