..word教育资料..word教育资料//初始密码为123456importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassMyATMextendsJFrameimplementsActionListener{JPanelpanelfirst,panelmain,panel3,panel4,panel5,panel6,panel7,panelchangepwd,panelchangepwded,panelsave,panelsaved,panelremain,paneltrans,paneltransed,panelmobile,panelmobiled,panelconsult;JButtonbtn0,btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10,btnsure,btnback,btnok,btncard,btngetcard,btnincard;JButtonbtn00,btn01,btn02,btn03,btn04,btn05,btn06,btn07,btn08,btn09,btn010,btnback1,btnremain,btnremain1,btnremain2;JButtonbtn000,btn001,btn002,btn003,btn004,btn005,btn006,btn007,btn008,btn009,btn100,btn200,btn300,btn1000,btn500,btnsure1,btnback2,btn0010,btnquok1,btnquok2,btnquok3,btnquok4;JButtonbtnpwd,btnpwd1,btnpwd2,btnpwd3,btnpwd4,btn11,btn12,btn13,btn14,btn15,btn16,btn17,btn18,btn19,btn20,btnsave,btnsave1,btnsave2,btnsaved,btnsaved1,btnsaved2,btnsaved3;JButtonbtntra,btntra1,btntra2,btntraed,btntraed1,btn21,btn22,btn23,btn24,btn25,btn26,btn27,btn28,btn29,btn30,btncon,btncon1;JButtonbtnmo,btnmo1,btnmo2,btnmo30,btnmo50,btnmo100,btnmo200,btnmo500,btnmo10,btnmo11,btnmo12,btnmo13,btnmo14,btnmo15,btnmo16,btnmo17,btnmo18,btnmo19,btnmoed,btnmoed1;JTextFieldtxt2,txttrans,txttrans1,txttrans2,txtmo,txtmo1;JLabellbljixu,lblpwd,lblwrong,lblqukuan,lblquok1,lblquok2,lblpwd1,lblpwd2,lblpwd3,lblpwd4,lblsave,lblsave1,lblsaved,lblremain,lblremain1,lbltra,lbltra1,lbltra2,lbltraed,lbltraed1;JLabellblwel,lblwel1,lblmo,lblmo1,lblmo2,lblmo3,lblmoed,lblmoed1,lblcon,lblcon1;JPasswordFieldtxt1,txtpwd,txtpwd1;Containercontainer;CardLayoutLayout;intmoney,savemoney,mobilemoney=0;doublelastmoney,trainsmoney;Stringuserpwd,cardnum,trains,username;..word教育资料booleanflag=true,flag1=false,flag2=false,flag3=true,flag4=false,flag5=false;//构造方法publicMyATM(){super(罗灿银行);this.setSize(435,350);this.setLocation(500,250);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置不可改变窗口大小this.setResizable(false);//设置程序小图标this.setIconImage(this.getToolkit().getImage(images\\haizei.jpg));}//布局publicvoidsetLayout(){//用卡片布局Layout=newCardLayout();container=getContentPane();container.setLayout(Layout);//添加第一张卡片panelfirst=newJPanel(null);//设置卡片的背景颜色panelfirst.setBackground(newColor(119,119,253));lbljixu=newJLabel(请放入磁卡,然后继续操作);//设置卡片在Panel中的位置lbljixu.setBounds(140,90,350,30);//为第一张卡片添加一个Labelpanelfirst.add(lbljixu);//为第一张卡片添加一个按钮btncard=newJButton(继续);btncard.setBounds(310,180,80,30);//为按钮注册事件监听器btncard.addActionListener(this);//开始时设置按钮不可按btncard.setEnabled(false);panelfirst.add(btncard);//为第一张卡片添加一个按钮btngetcard=newJButton(取卡);btngetcard.setEnabled(false);..word教育资料btngetcard.setBounds(310,220,80,30);btngetcard.addActionListener(this);panelfirst.add(btngetcard);//为第一张卡片添加一个按钮btnincard=newJButton(插卡);btnincard.setBounds(40,220,80,30);btnincard.addActionListener(this);panelfirst.add(btnincard);container.add(panelfirst,first);//添加登录输入密码卡片panelmain=newJPanel(null);panelmain.setBackground(newColor(119,119,253));lblpwd=newJLabel(请输入您的银行卡密码:);panelmain.add(lblpwd);lblpwd.setBounds(150,20,150,30);//设置文本框为密码型txt1=newJPasswordField(12);//文本框不可选中txt1.enable(false);panelmain.add(txt1);//文本框的输入内容用*显示txt1.setEchoChar('*');txt1.setBounds(115,50,200,30);//添加选择按钮btnsure=newJButton(确定);btnsure.addActionListener(this);panelmain.add(btnsure);btnsure.setBounds(70,160,80,30);//添加重输按钮btn010=newJButton(重输);btn010.addActionListener(this);panelmain.add(btn010);btn010.setBounds(175,160,80,30);btnback=newJButton(退出);btnback.addActionListener(this);panelmain.add(btnback);btnback.setBounds(280,160,80,30);..word教育资料lblwrong=newJLabel(请注意保护好您的密码!);panelmain.add(lblwrong);lblwrong.setBounds(150,90,200,30);//添加输入按钮btn01=newJButton(1);btn01.addActionListener(this);panelmain.add(btn01);btn01.setBounds(45,210,60,30);btn02=newJButton(2);btn02.addActionListener(this);panelmain.add(btn02);btn02.setBounds(115,210,60,30);btn03=newJButton(3);btn03.addActionListener(this);panelmain.add(btn03);btn03.setBounds(185,210,60,30);btn04=newJButton(4);btn04.addActionListener(this);panelmain.add(btn04);btn04.setBounds(255,210,60,30);btn05=newJButton(5);btn05.addActionListener(this);panelmain.add(btn05);btn05.setBounds(325,210,60,30);btn06=newJButton(6);btn06.addActionListener(this);panelmain.add(btn06);btn06.setBounds(45,260,60,30);btn07=newJButton(7);btn07.addActionListener(this);panelmain.add(btn07);btn07.setBounds(115,260,60,30);container.add(panelmain,main);btn08=newJButton(8);btn08.addActionListener(this);..word教育资料panelmain.add(btn08);btn08.setBounds(185,260,60,30);btn09=newJButton(9);btn09.addActionListener(this);panelmain.add(btn09);btn09.setBounds(255,260,60,30);btn00=newJButton(0);btn00.addActionListener(this);panelmain.add(btn00);btn00.setBounds(325,260,60,30);//添加主界面卡片panel3=newJPanel(null);panel3.setBackground(newColor(119,119,253));lblwel=newJLabel(username+,欢迎使用罗灿银行ATM系统);lblwel.setBounds(20,15,350,30);panel3.add(lblwel);lblwel1=newJLabel(请选择您需要的交易类型);lblwel1.setBounds(220,55,350,30);panel3.add(lblwel1);btn3=newJButton(取款服务);btn3.addActionListener(this);bt