版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、/初始密码为123456import java.awt.*;import java.awt.event.*;import javax.swing.*;public class myatm extends jframe implements actionlistenerjpanel panelfirst,panelmain,panel3,panel4,panel5,panel6,panel7,panelchangepwd,panelchangepwded,panelsave,panelsaved,panelremain,paneltrans,paneltransed,panelmobile,pa
2、nelmobiled,panelconsult;jbutton btn0,btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10,btnsure,btnback,btnok,btncard,btngetcard,btnincard;jbutton btn00,btn01,btn02,btn03,btn04,btn05,btn06,btn07,btn08,btn09,btn010,btnback1,btnremain,btnremain1,btnremain2;jbutton btn000,btn001,btn002,btn003,btn004,bt
3、n005,btn006,btn007,btn008,btn009,btn100,btn200,btn300,btn1000,btn500,btnsure1,btnback2,btn0010,btnquok1,btnquok2,btnquok3,btnquok4;jbutton btnpwd,btnpwd1,btnpwd2,btnpwd3,btnpwd4,btn11,btn12,btn13,btn14,btn15,btn16,btn17,btn18,btn19,btn20,btnsave,btnsave1,btnsave2,btnsaved,btnsaved1,btnsaved2,btnsave
4、d3;jbutton btntra,btntra1,btntra2,btntraed,btntraed1,btn21,btn22,btn23,btn24,btn25,btn26,btn27,btn28,btn29,btn30,btncon,btncon1;jbutton btnmo,btnmo1,btnmo2,btnmo30,btnmo50,btnmo100,btnmo200,btnmo500,btnmo10,btnmo11,btnmo12,btnmo13,btnmo14,btnmo15,btnmo16,btnmo17,btnmo18,btnmo19,btnmoed,btnmoed1;jtex
5、tfield txt2,txttrans,txttrans1,txttrans2,txtmo,txtmo1;jlabel lbljixu,lblpwd,lblwrong,lblqukuan,lblquok1,lblquok2,lblpwd1,lblpwd2,lblpwd3,lblpwd4,lblsave,lblsave1,lblsaved,lblremain,lblremain1,lbltra,lbltra1,lbltra2,lbltraed,lbltraed1;jlabel lblwel,lblwel1,lblmo,lblmo1,lblmo2,lblmo3,lblmoed,lblmoed1,
6、lblcon,lblcon1;jpasswordfield txt1,txtpwd,txtpwd1;container container;cardlayout layout;int money,savemoney,mobilemoney=0;double lastmoney,trainsmoney;string userpwd,cardnum,trains,username;boolean flag=true,flag1=false,flag2=false,flag3=true,flag4=false,flag5=false;/构造方法public myatm()super(罗灿银行);th
7、is.setsize(435,350);this.setlocation(500, 250);this.setdefaultcloseoperation(jframe.exit_on_close ); /设置不可改变窗口大小this.setresizable(false); /设置程序小图标this.seticonimage(this.gettoolkit().getimage(imageshaizei.jpg);/布局public void setlayout()/用卡片布局layout=new cardlayout();container=getcontentpane();containe
8、r.setlayout(layout);/添加第一张卡片panelfirst=new jpanel(null);/设置卡片的背景颜色panelfirst.setbackground(new color(119,119,253);lbljixu=new jlabel(请放入磁卡,然后继续操作);/设置卡片在panel中的位置lbljixu.setbounds(140,90,350,30);/为第一张卡片添加一个labelpanelfirst.add(lbljixu);/为第一张卡片添加一个按钮btncard=new jbutton(继续);btncard.setbounds(310,180,80
9、,30);/为按钮注册事件监听器btncard.addactionlistener(this);/开始时设置按钮不可按btncard.setenabled(false);panelfirst.add(btncard);/为第一张卡片添加一个按钮btngetcard=new jbutton(取卡);btngetcard.setenabled(false);btngetcard.setbounds(310,220,80,30);btngetcard.addactionlistener(this);panelfirst.add(btngetcard);/为第一张卡片添加一个按钮btnincard=n
10、ew jbutton(插卡);btnincard.setbounds(40,220,80,30);btnincard.addactionlistener(this);panelfirst.add(btnincard);container.add(panelfirst,first);/添加登录输入密码卡片panelmain=new jpanel(null);panelmain.setbackground(new color(119,119,253);lblpwd=new jlabel(请输入您的银行卡密码:);panelmain.add(lblpwd);lblpwd.setbounds(150,
11、 20, 150, 30);/设置文本框为密码型txt1=new jpasswordfield(12);/文本框不可选中txt1.enable(false);panelmain.add(txt1);/文本框的输入内容用*显示txt1.setechochar(*);txt1.setbounds(115,50,200,30);/添加选择按钮btnsure=new jbutton(确定);btnsure.addactionlistener(this);panelmain.add(btnsure);btnsure.setbounds(70,160,80,30);/添加重输按钮btn010=new jb
12、utton(重输);btn010.addactionlistener(this);panelmain.add(btn010);btn010.setbounds(175,160,80,30);btnback=new jbutton(退出);btnback.addactionlistener(this);panelmain.add(btnback);btnback.setbounds(280,160,80,30);lblwrong=new jlabel(请注意保护好您的密码!);panelmain.add(lblwrong);lblwrong.setbounds(150,90,200,30);/添
13、加输入按钮btn01=new jbutton(1);btn01.addactionlistener(this);panelmain.add(btn01);btn01.setbounds(45,210,60,30);btn02=new jbutton(2);btn02.addactionlistener(this);panelmain.add(btn02);btn02.setbounds(115,210,60,30);btn03=new jbutton(3);btn03.addactionlistener(this);panelmain.add(btn03);btn03.setbounds(18
14、5,210,60,30);btn04=new jbutton(4);btn04.addactionlistener(this);panelmain.add(btn04);btn04.setbounds(255,210,60,30);btn05=new jbutton(5);btn05.addactionlistener(this);panelmain.add(btn05);btn05.setbounds(325,210,60,30);btn06=new jbutton(6);btn06.addactionlistener(this);panelmain.add(btn06);btn06.set
15、bounds(45,260,60,30);btn07=new jbutton(7);btn07.addactionlistener(this);panelmain.add(btn07);btn07.setbounds(115,260,60,30);container.add(panelmain,main);btn08=new jbutton(8);btn08.addactionlistener(this);panelmain.add(btn08);btn08.setbounds(185,260,60,30);btn09=new jbutton(9);btn09.addactionlistene
16、r(this);panelmain.add(btn09);btn09.setbounds(255,260,60,30);btn00=new jbutton(0);btn00.addactionlistener(this);panelmain.add(btn00);btn00.setbounds(325,260,60,30);/添加主界面卡片panel3=new jpanel(null);panel3.setbackground(new color(119,119,253);lblwel=new jlabel(username+,欢迎使用罗灿银行atm系统);lblwel.setbounds(2
17、0,15,350,30);panel3.add(lblwel);lblwel1=new jlabel(请选择您需要的交易类型);lblwel1.setbounds(220,55,350,30);panel3.add(lblwel1);btn3=new jbutton(取款服务);btn3.addactionlistener(this);btn3.setbounds(20,90,100,30);panel3.add(btn3);btn4=new jbutton(修改密码);btn4.addactionlistener(this);btn4.setbounds(20,150,100,30);pan
18、el3.add(btn4);btn5=new jbutton(存款服务);btn5.addactionlistener(this);btn5.setbounds(20,210,100,30);panel3.add(btn5);btn6=new jbutton(查询余额);btn6.addactionlistener(this);btn6.setbounds(20,270,100,30);panel3.add(btn6);btn7=new jbutton(转账服务);btn7.addactionlistener(this);btn7.setbounds(300,90,100,30);panel3
19、.add(btn7);btn8=new jbutton(通信交费);btn8.addactionlistener(this);btn8.setbounds(300,150,100,30);panel3.add(btn8);btn9=new jbutton(咨询服务);btn9.addactionlistener(this);btn9.setbounds(300,210,100,30);panel3.add(btn9);btn10=new jbutton(退出操作);btn10.addactionlistener(this);btn10.setbounds(300,270,100,30);pan
20、el3.add(btn10);container.add(panel3,three);/添加取款页面卡片panel4=new jpanel(null);panel4.setbackground(new color(119,119,253);lblqukuan=new jlabel(请输入您的取款数:);panel4.add(lblqukuan);lblqukuan.setbounds(115, 20, 150, 30);lblqukuan=new jlabel(提示:只能是100元或100元的整数倍。);panel4.add(lblqukuan);lblqukuan.setbounds(115
21、, 50, 300, 30);txt2=new jtextfield(12);txt2.enable(false);panel4.add(txt2);txt2.setbounds(115,90,200,30);btn100=new jbutton(100);panel4.add(btn100);btn100.addactionlistener(this);btn100.setbounds(45,190,60,30);btn200=new jbutton(200);panel4.add(btn200);btn200.addactionlistener(this);btn200.setbounds
22、(115,190,60,30);btn300=new jbutton(300);panel4.add(btn300);btn300.addactionlistener(this);btn300.setbounds(185,190,60,30);btn500=new jbutton(500);panel4.add(btn500);btn500.addactionlistener(this);btn500.setbounds(255,190,60,30);btn1000=new jbutton(1000);panel4.add(btn1000);btn1000.addactionlistener(
23、this);btn1000.setbounds(325,190,65,30);btn001=new jbutton(1);panel4.add(btn001);btn001.addactionlistener(this);btn001.setbounds(45,230,60,30);btn002=new jbutton(2);panel4.add(btn002);btn002.addactionlistener(this);btn002.setbounds(115,230,60,30);btn003=new jbutton(3);panel4.add(btn003);btn003.addact
24、ionlistener(this);btn003.setbounds(185,230,60,30);btn004=new jbutton(4);panel4.add(btn004);btn004.addactionlistener(this);btn004.setbounds(255,230,60,30);btn005=new jbutton(5);panel4.add(btn005);btn005.addactionlistener(this);btn005.setbounds(325,230,65,30);btn006=new jbutton(6);panel4.add(btn006);b
25、tn006.addactionlistener(this);btn006.setbounds(45,270,60,30);btn007=new jbutton(7);panel4.add(btn007);btn007.addactionlistener(this);btn007.setbounds(115,270,60,30);btn008=new jbutton(8);panel4.add(btn008);btn008.addactionlistener(this);btn008.setbounds(185,270,60,30);btn009=new jbutton(9);panel4.ad
26、d(btn009);btn009.addactionlistener(this);btn009.setbounds(255,270,60,30);btn000=new jbutton(0);panel4.add(btn000);btn000.addactionlistener(this);btn000.setbounds(325,270,65,30);btnsure1=new jbutton(确定);panel4.add(btnsure1);btnsure1.addactionlistener(this);btnsure1.setbounds(70,140,80,30);btn0010=new
27、 jbutton(重输);panel4.add(btn0010);btn0010.addactionlistener(this);btn0010.setbounds(175,140,80,30);btnback2=new jbutton(返回);panel4.add(btnback2);btnback2.addactionlistener(this);btnback2.setbounds(280,140,80,30);container.add(panel4,four);/添加完成取款操作需要显示的卡片panel5=new jpanel(null);panel5.setbackground(n
28、ew color(119,119,253);lblquok1=new jlabel(取款成功,你本次取款数额为+txt2.gettext()+,是否继续操作?);lblquok1.setbounds(60, 110, 350, 30);panel5.add(lblquok1);btnquok1=new jbutton(继续取款);panel5.add(btnquok1);btnquok1.addactionlistener(this);btnquok1.setbounds(30, 185, 90, 30);btnquok2=new jbutton(打印凭条);panel5.add(btnquo
29、k2);btnquok2.addactionlistener(this);btnquok2.setbounds(30, 240, 90, 30);btnquok3=new jbutton(其它操作);panel5.add(btnquok3);btnquok3.addactionlistener(this);btnquok3.setbounds(300, 185, 90, 30);btnquok4=new jbutton(退出操作);panel5.add(btnquok4);btnquok4.addactionlistener(this);btnquok4.setbounds(300, 240,
30、 90, 30);container.add(panel5,five);/添加修改密码界面卡片panelchangepwd=new jpanel(null);panelchangepwd.setbackground(new color(119,119,253);lblpwd1=new jlabel(请输入您需要修改的6位密码:);lblpwd1.setbounds(115, 30, 300, 30);panelchangepwd.add(lblpwd1);lblpwd2=new jlabel(请再次输入您需要修改的6位密码:);lblpwd2.setbounds(115, 110, 300,
31、30);panelchangepwd.add(lblpwd2);txtpwd=new jpasswordfield(12);txtpwd.enable(false);txtpwd.setechochar(*);panelchangepwd.add(txtpwd);txtpwd.setbounds(115,70,200,30);txtpwd1=new jpasswordfield(12);txtpwd1.enable(false);txtpwd1.setechochar(*);panelchangepwd.add(txtpwd1);txtpwd1.setbounds(115,150,200,30
32、);btnpwd=new jbutton(确定);panelchangepwd.add(btnpwd);btnpwd.addactionlistener(this);btnpwd.setbounds(70,190,80,30);btnpwd1=new jbutton(重输);panelchangepwd.add(btnpwd1);btnpwd1.addactionlistener(this);btnpwd1.setbounds(175,190,80,30);btnpwd2=new jbutton(返回);panelchangepwd.add(btnpwd2);btnpwd2.addaction
33、listener(this);btnpwd2.setbounds(280,190,80,30);btn11=new jbutton(1);panelchangepwd.add(btn11);btn11.addactionlistener(this);btn11.setbounds(45,230,60,30);btn12=new jbutton(2);panelchangepwd.add(btn12);btn12.addactionlistener(this);btn12.setbounds(115,230,60,30);btn13=new jbutton(3);panelchangepwd.a
34、dd(btn13);btn13.addactionlistener(this);btn13.setbounds(185,230,60,30);btn14=new jbutton(4);panelchangepwd.add(btn14);btn14.addactionlistener(this);btn14.setbounds(255,230,60,30);btn15=new jbutton(5);panelchangepwd.add(btn15);btn15.addactionlistener(this);btn15.setbounds(325,230,60,30);btn16=new jbu
35、tton(6);panelchangepwd.add(btn16);btn16.addactionlistener(this);btn16.setbounds(45,270,60,30);btn17=new jbutton(7);panelchangepwd.add(btn17);btn17.addactionlistener(this);btn17.setbounds(115,270,60,30);btn18=new jbutton(8);panelchangepwd.add(btn18);btn18.addactionlistener(this);btn18.setbounds(185,2
36、70,60,30);btn19=new jbutton(9);panelchangepwd.add(btn19);btn19.addactionlistener(this);btn19.setbounds(255,270,60,30);btn20=new jbutton(0);panelchangepwd.add(btn20);btn20.addactionlistener(this);btn20.setbounds(325,270,60,30);container.add(panelchangepwd,changepwd);/添加修改密码完成显示界面卡片panelchangepwded=ne
37、w jpanel(null);panelchangepwded.setbackground(new color(119,119,253);lblpwd3=new jlabel(修改密码成功,请妥善保管好您的密码。);lblpwd3.setbounds(90,70,350,30);panelchangepwded.add(lblpwd3);btnpwd3=new jbutton(继续操作);btnpwd3.setbounds(95,110,90,30);btnpwd3.addactionlistener(this);panelchangepwded.add(btnpwd3);btnpwd4=ne
38、w jbutton(退出操作);btnpwd4.setbounds(200,110,90,30);btnpwd4.addactionlistener(this);panelchangepwded.add(btnpwd4);container.add(panelchangepwded,changgepwded);/添加存款显示界面卡片panelsave=new jpanel(null);panelsave.setbackground(new color(119,119,253);lblsave=new jlabel(请在存款口处放入存款);lblsave.setbounds(90,70,350,
39、30);panelsave.add(lblsave);lblsave1=new jlabel(请注意:只接收100元或100元的整数倍存款);lblsave1.setbounds(90,110,350,30);panelsave.add(lblsave1);btnsave=new jbutton(放入存款完毕);btnsave.setbounds(60,160,120,30);btnsave.addactionlistener(this);panelsave.add(btnsave);btnsave1=new jbutton(继续);btnsave1.setbounds(200,160,60,
40、30);btnsave1.addactionlistener(this);panelsave.add(btnsave1);btnsave2=new jbutton(返回);btnsave2.setbounds(280,160,60,30);btnsave2.addactionlistener(this);panelsave.add(btnsave2);container.add(panelsave,save);/添加存款完成显示界面卡片panelsaved=new jpanel(null);panelsaved.setbackground(new color(119,119,253);lbls
41、aved=new jlabel(你本次的存款数额为+savemoney+元,是否继续操作?);lblsaved.setbounds(85, 110, 350, 30);panelsaved.add(lblsaved);btnsaved=new jbutton(继续存款);panelsaved.add(btnsaved);btnsaved.addactionlistener(this);btnsaved.setbounds(30, 185, 90, 30);btnsaved1=new jbutton(打印凭条);panelsaved.add(btnsaved1);btnsaved1.addact
42、ionlistener(this);btnsaved1.setbounds(30, 240, 90, 30);btnsaved2=new jbutton(其他操作);panelsaved.add(btnsaved2);btnsaved2.addactionlistener(this);btnsaved2.setbounds(300, 185, 90, 30);btnsaved3=new jbutton(退出操作);panelsaved.add(btnsaved3);btnsaved3.addactionlistener(this);btnsaved3.setbounds(300, 240, 9
43、0, 30);container.add(panelsaved,saved);/添加查询余额界面卡片panelremain=new jpanel(null);panelremain.setbackground(new color(119,119,253);lblremain1=new jlabel(卡号:+cardnum);lblremain1.setbounds(90,70,350,30);panelremain.add(lblremain1);lblremain=new jlabel(您的余额为+lastmoney+元,请继续您的操作!);lblremain.setbounds(90,11
44、0,350,30);panelremain.add(lblremain);btnremain=new jbutton(继续操作);btnremain.setbounds(95,150,90,30);btnremain.addactionlistener(this);panelremain.add(btnremain);btnremain1=new jbutton(退出操作);btnremain1.setbounds(200,150,90,30);btnremain1.addactionlistener(this);panelremain.add(btnremain1);container.ad
45、d(panelremain,remain);/添加手机充值卡片界面paneltrans=new jpanel(null);paneltrans.setbackground(new color(119,119,253);lbltra=new jlabel(请输入对方的19位帐号:);lbltra.setbounds(20, 30, 160, 30);paneltrans.add(lbltra);lbltra1=new jlabel(请再次输入对方的19位帐号:);lbltra1.setbounds(20, 80, 190, 30);paneltrans.add(lbltra1);lbltra2=
46、new jlabel(请输入您的转账金额:);lbltra2.setbounds(20, 130, 160, 30);paneltrans.add(lbltra2);txttrans=new jtextfield(6,19);txttrans.enable(false);paneltrans.add(txttrans);txttrans.setbounds(200,30,200,30);txttrans1=new jtextfield(6,19);txttrans1.enable(false);paneltrans.add(txttrans1);txttrans1.setbounds(200,
47、80,200,30);txttrans2=new jtextfield(,19);txttrans2.enable(false);paneltrans.add(txttrans2);txttrans2.setbounds(200,130,200,30);btntra=new jbutton(确定);paneltrans.add(btntra);btntra.addactionlistener(this);btntra.setbounds(70,190,80,30);btntra1=new jbutton(重输);paneltrans.add(btntra1);btntra1.addaction
48、listener(this);btntra1.setbounds(175,190,80,30);btntra2=new jbutton(返回);paneltrans.add(btntra2);btntra2.addactionlistener(this);btntra2.setbounds(280,190,80,30);btn21=new jbutton(1);paneltrans.add(btn21);btn21.addactionlistener(this);btn21.setbounds(45,230,60,30);btn22=new jbutton(2);paneltrans.add(
49、btn22);btn22.addactionlistener(this);btn22.setbounds(115,230,60,30);btn23=new jbutton(3);paneltrans.add(btn23);btn23.addactionlistener(this);btn23.setbounds(185,230,60,30);btn24=new jbutton(4);paneltrans.add(btn24);btn24.addactionlistener(this);btn24.setbounds(255,230,60,30);btn25=new jbutton(5);pan
50、eltrans.add(btn25);btn25.addactionlistener(this);btn25.setbounds(325,230,60,30);btn26=new jbutton(6);paneltrans.add(btn26);btn26.addactionlistener(this);btn26.setbounds(45,270,60,30);btn27=new jbutton(7);paneltrans.add(btn27);btn27.addactionlistener(this);btn27.setbounds(115,270,60,30);btn28=new jbutton(8);paneltrans.add(btn28);btn28.addactionlistener(this);btn28.setbounds(185,270,60,30);btn29=new jbutton(9);paneltrans.add(btn29);btn29.addactionlistener(this);btn29.setbound
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 离婚财产分割合同模板
- 保安公司安保人员聘用合同样本
- 旅游设施建设报名表
- 建筑脚手架施工合同副本
- 2024年动画电影配音协议
- 电力设备检修员聘用合同样本
- 高三班主任工作计划(5篇)
- 企业咨询服务合同
- 2024年度农业技术推广与服务合同
- 企业总部二手房交易合同模板
- 24秋国家开放大学《0-3岁婴幼儿的保育与教育》期末大作业参考答案
- 相对湿度计算公式
- 2024版肿瘤患者静脉血栓防治指南解读 课件
- 商业银行开展非法集资风险排查活动情况报告
- 英语连读发音技巧讲解
- 危货运输车辆挂靠协议
- 加快推进涉外法治建设
- 绿色供应链管理企业一般要求符合性评价表
- 中航集团招聘笔试题库2024
- 某系统安防工程施工组织设计方案
- 2024年7月13日云南省昆明市直遴选笔试真题及解析综合管理岗
评论
0/150
提交评论