版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
.z.-----總結(jié)資料課程論文現(xiàn)代軟件工程與實(shí)踐題目:ATM柜員機(jī)模擬程序?qū)W院〔系〕:信息工程學(xué)院專業(yè)班級:學(xué)生**:指導(dǎo)教師:2011年12月4日-.z.摘要通過設(shè)計(jì)ATM柜員模擬程序,加深自己對Java編程尤其是對Java圖形用戶界面編程的了解,將自己的學(xué)到的編程知識(shí)融會(huì)貫穿,同時(shí)培養(yǎng)自身面向?qū)ο筌浖_發(fā)的思維,初步了解軟件開發(fā)的一般流程,提高用Java實(shí)際動(dòng)手能力并增強(qiáng)自己對面向?qū)ο蟮牧私?。通過這次編程設(shè)計(jì),加深了對Java圖形界面編程中各個(gè)模塊和組件的應(yīng)用了解,以及類和類之間的關(guān)系,界面排版的處理等。設(shè)計(jì)要求是,當(dāng)輸入給定的卡號(hào)和密碼〔初始卡號(hào)和密碼為123456〕時(shí),系統(tǒng)能登錄ATM柜員機(jī)系統(tǒng),用戶可以按照以下規(guī)則進(jìn)展〔規(guī)則可以按照實(shí)際系統(tǒng)做需求〕:〔1〕查詢余額:初始余額為10000元?!?〕ATM取款:每次取款金額為100的倍數(shù),總額不超過5000元,支取金額不允許透支。〔3〕ATM存款:不能出現(xiàn)負(fù)存款。〔4〕修改密碼:新密碼長度不小于6位,不允許出現(xiàn)6位完全一樣的情況,只有舊密碼正確,新密碼符合要求,且兩次輸入一樣的情況下才可以成功修改密碼。該程序設(shè)置了7個(gè)類,1個(gè)主類6個(gè)輔助類,6個(gè)輔助類都是內(nèi)部類的形式,輔助類包括五個(gè)實(shí)現(xiàn)ATM的功能,一個(gè)存放客戶資料,之所以用內(nèi)部類來實(shí)現(xiàn)是為了在各個(gè)界面轉(zhuǎn)換時(shí)不至于要?jiǎng)?chuàng)立多個(gè)對象,每一個(gè)輔助類的對象只要在主類中創(chuàng)立一次就可以在各個(gè)內(nèi)部類中引用。該程序利用的功能是利用Java事件監(jiān)聽技術(shù)來實(shí)現(xiàn)的,各種功能單獨(dú)的創(chuàng)立一個(gè)類來實(shí)現(xiàn),不會(huì)互相混淆,更加容易理清楚思路。設(shè)計(jì)的程序完美的實(shí)現(xiàn)了設(shè)計(jì)要求,具有查詢、取款、存款、修改密碼等功能。-.z.--總結(jié)資料目錄摘要I目錄II1前言11.1設(shè)計(jì)任務(wù)11.1.1需求說明11.2設(shè)計(jì)內(nèi)容12程序要求13算法分析24流程圖35程序源代碼及說明45.1程序源代碼45.2源代碼說明215.2.1源代碼中自定義類的說明:21源代碼中的事件監(jiān)聽器226調(diào)試及運(yùn)行結(jié)果237體會(huì)298參考文獻(xiàn)30-.z.1前言1.1設(shè)計(jì)任務(wù)1.1.1需求說明隨著市場經(jīng)濟(jì)的繁榮開展,人們的物質(zhì)生活得到極大的提高,手中的剩余資金也日益增多。受傳統(tǒng)觀念影響,絕大多數(shù)人喜歡把資金投進(jìn)銀行,而在需要使用現(xiàn)金的時(shí)候再到銀行提取現(xiàn)金。這就導(dǎo)致銀行業(yè)務(wù)的急劇增加。雖然銀行網(wǎng)點(diǎn)越來越多,銀行的工作效率也隨著信息化有較明顯的增長,但是依舊不能滿足廣闊用戶的需要。而一味的增加營業(yè)網(wǎng)點(diǎn),從理論上雖然能稍微的緩解銀行的壓力,但是治標(biāo)不治本,而且每增加一個(gè)網(wǎng)點(diǎn),不僅要付出昂貴的資金本錢,還需要長期投入人力資本,本錢非常之昂貴。這時(shí)候就迫切的需要一種自動(dòng)的,易于普及的,低本錢的設(shè)備來解決這一問題。于是ATM機(jī)系統(tǒng)應(yīng)運(yùn)而生了。本文正是通過設(shè)計(jì)一個(gè)ATM模擬模擬程序來實(shí)現(xiàn)ATM機(jī)系統(tǒng)的根本功能,充分運(yùn)用自己所學(xué)的Java知識(shí)進(jìn)展設(shè)計(jì)編程。1.2設(shè)計(jì)內(nèi)容〔1〕程序要求〔2〕算法分析〔3〕流程圖〔4〕源程序〔5〕調(diào)試及運(yùn)行結(jié)果〔6〕體會(huì)2程序要求本ATM柜員機(jī)的主要功能如下所述:要求使用圖形用戶界面。當(dāng)輸入給定的卡號(hào)和密碼〔初始卡號(hào)和密碼為123456〕時(shí),系統(tǒng)能登錄ATM柜員機(jī)系統(tǒng),用戶可以按照以下規(guī)則進(jìn)展:查詢余額:初始余額為10000元。ATM取款:每次取款金額為100的倍數(shù),總額不超過5000元,支取金額不允許透支。ATM存款:不能出現(xiàn)負(fù)存款。修改密碼:新密碼長度不小于6位,不允許出現(xiàn)6位完全一樣的情況,只有舊密碼正確,新密碼符合要求,且兩次輸入一樣的情況下才可以成功修改密碼。3算法分析通過程序要求,我們可以清楚的知道本次設(shè)計(jì)的ATM柜員模擬程序需要實(shí)現(xiàn)四大功能,即查詢余額、取款、存款、修改密碼。初次之外,作為ATM系統(tǒng),還需要最根本的兩大功能,即登陸和退出。根據(jù)上述的功能分析,我們可以吧整個(gè)ATM系統(tǒng)分為登陸模塊、查詢模塊、取款模塊、存款模塊、修改密碼模塊。除此之外,還有在登陸系統(tǒng)后的功能選擇模塊,退出功能則鑲嵌在各個(gè)需要的模塊中。由于各個(gè)模塊的功能實(shí)現(xiàn)是通過界面顯示出來的,則程序設(shè)計(jì)又可以理解為幾大界面的設(shè)計(jì):登陸界面、主界面、查詢余額界面、取款界面、存款界面、修改密碼界面。除了幾大界面之外,還有系統(tǒng)的初始化,主要是初始卡號(hào)、密碼的設(shè)定等。在程序的大體框架確定之后,我們需要了解各個(gè)模塊所要實(shí)現(xiàn)和需要具有的功能。根據(jù)現(xiàn)有的銀行ATM系統(tǒng),我們可以很快就可以了解本次設(shè)計(jì)的ATM系統(tǒng)應(yīng)該具有的操作?!?〕登陸界面用戶輸入正確的賬號(hào)和密碼就可以登錄到該系統(tǒng)的主界面中去,進(jìn)展相應(yīng)的操作:取款、存款、查詢、修改密碼?!?〕主界面主界面包括查詢、存款、取款、修改密碼、退出的功能按鈕,按下相應(yīng)的按鈕,可以進(jìn)展相應(yīng)的操作?!?〕查詢界面在主界面中按下查詢按鈕可以進(jìn)展查詢操作。通過查詢功能我們可以查詢賬戶的余額,在查詢過程中我們可以選擇取款的業(yè)務(wù),除此之外,查詢界面之中還有返回和退出的操作。返回的操作會(huì)使用戶回到主界面,退出的操作會(huì)使用戶直接回到登陸界面?!?〕取款界面取款界面既可以通過主界面進(jìn)入,也可以通過查詢、存款等操作過程中的界面進(jìn)入。取款功能在對話框中輸入你想要取出的金額,但是次金額不可以比賬戶的余額大,且必須是100的整數(shù)倍,取款完畢,會(huì)彈出是否顯示余額的提示,選"是〞的話就會(huì)進(jìn)入查詢界面,選"否〞的話,則回到主界面。〔5〕存款界面在主界面按下存款按鈕可以進(jìn)展存款操作,在對話中輸入你需要存入的金額,所輸入的數(shù)字也要是100的整數(shù)倍,而且不可以是負(fù)數(shù)。存款完畢,會(huì)彈出是否顯示余額的提示,選"是〞的話就會(huì)進(jìn)入查詢界面,選"否〞的話,則回到主界面?!?〕修改密碼選擇修改密碼按鈕可以進(jìn)展修改密碼房,但是要先輸入就密碼正確并且兩次輸入新密碼一致才可以修改密碼。修改完成后,會(huì)返回主界面。4流程圖圖1程序流程圖5程序源代碼及說明5.1程序源代碼importjava*.swing.*;importjava*.swing.JOptionPane;importjava.awt.event.*;publicclassATMmodel{Accountmyaccount=newAccount();Loadload=newLoad();MainFrameJmain=newMainFrame();Taketake=newTake();Inputinput=newInput();Displaydis=newDisplay();Setpwsetpw=newSetpw();publicATMmodel(){JOptionPane.showMessageDialog(null,"歡送使用ATM柜員模擬系統(tǒng)"); }publicstaticvoidmain(String[]args){ATMmodelatm=newATMmodel();}/*創(chuàng)立賬戶*/classAccount{privateintcount=10000;//初始賬戶余額10000privateStringaccount="123456";//初始賬號(hào)privateStringpassword="123456";//初始密碼publicAccount(){}publicvoidsetpw(Stringpassword){this.password=password;}publicvoiddeccount(intmoney){count-=money;}publicvoidreccount(intmoney){count+=money; }publicintget(){returncount;}publicStringgetaccount(){//賬號(hào)returnaccount;}publicStringgetpw(){returnpassword; }}/* 主界面*/classMainFramee*tendsJFrame{publicuttonchecked;publicuttoncunkuan;publicuttonquit;publicuttonqukuan;publicuttonreset;publicMainFrame(){initponents();this.setLocationRelativeTo(null);//this.setVisible(false);}/*控件初始化*/privatevoidinitponents(){cunkuan=newutton();qukuan=newutton();checked=newutton();reset=newutton();quit=newutton(); setDefaultCloseOperation(WindowConstants.E*IT_ON_CLOSE);setTitle("ATM柜員模擬程序"); setName("mianframe");setResizable(false);cunkuan.setTe*t("存款");cunkuan.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){cunkuanActionPerformed(evt);}}); qukuan.setTe*t("取款");qukuan.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){qukuanActionPerformed(evt);}}); checked.setTe*t("查詢");checked.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){checkedActionPerformed(evt);}}); reset.setTe*t("修改密碼");reset.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){resetActionPerformed(evt);}}); quit.setTe*t("退出");quit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){quitActionPerformed(evt);}}); GroupLayoutlayout=newGroupLayout(getContentPane());//GroupLayout它將組件按層次分組,以決定它們在Container中的位置getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addponent(cunkuan).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,105,Short.MA*_VALUE).addponent(reset)).addGroup(java*.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup().addponent(qukuan).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,143,Short.MA*_VALUE).addponent(quit)).addponent(checked)).addContainerGap()));layout.setVerticalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(46,46,46).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(cunkuan).addponent(reset)).addGap(51,51,51).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(quit).addponent(qukuan)).addGap(57,57,57).addponent(checked).addGap(39,39,39)));pack();}privatevoidquitActionPerformed(ActionEventevt){ load.setVisible(true);this.setVisible(false);}privatevoidresetActionPerformed(ActionEventevt){ setpw.setVisible(true);this.setVisible(false); }privatevoidcheckedActionPerformed(ActionEventevt){dis.setVisible(true);this.setVisible(false);}privatevoidqukuanActionPerformed(ActionEventevt){take.setVisible(true);this.setVisible(false);}privatevoidcunkuanActionPerformed(ActionEventevt){ input.setVisible(true);this.setVisible(false);}}/*登錄界面*/classLoade*tendsJFrame{ publicJPasswordFieldJpassword;publicJTe*tFieldaccountnum;publicuttonmit;privateJLabeljL1;privateJLabeljL2;publicLoad(){initponents();this.setLocationRelativeTo(null);this.setVisible(true);}privatevoidinitponents(){jL1=newJLabel();jL2=newJLabel();accountnum=newJTe*tField();mit=newutton();Jpassword=newJPasswordField();setDefaultCloseOperation(WindowConstants.E*IT_ON_CLOSE);setTitle("ATM柜員模擬程序");setResizable(false);jL1.setTe*t("賬號(hào):");jL2.setTe*t("密碼:");mit.setTe*t("確定");mit.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){mitActionPerformed(evt);}});java*.swing.GroupLayoutlayout=newjava*.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap(50,Short.MA*_VALUE).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.TRAILING).addponent(jL1).addponent(jL2)).addGap(31,31,31).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING,false).addponent(Jpassword).addponent(accountnum,java*.swing.GroupLayout.DEFAULT_SIZE,143,Short.MA*_VALUE))).addGroup(layout.createSequentialGroup().addGap(122,122,122).addponent(mit))).addContainerGap(72,Short.MA*_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(85,85,85).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(accountnum,java*.swing.GroupLayout.PREFERRED_SIZE,java*.swing.GroupLayout.DEFAULT_SIZE,java*.swing.GroupLayout.PREFERRED_SIZE).addponent(jL1)).addGap(41,41,41).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(jL2).addponent(Jpassword,java*.swing.GroupLayout.PREFERRED_SIZE,java*.swing.GroupLayout.DEFAULT_SIZE,java*.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,72,Short.MA*_VALUE).addponent(mit).addGap(64,64,64)));pack();}privatevoidmitActionPerformed(ActionEventevt){if(accountnum.getTe*t().equals(myaccount.getaccount())&&Jpassword.getTe*t().equals(myaccount.getpw())) { Jmain.setVisible(true);this.setVisible(false); accountnum.setTe*t(""); Jpassword.setTe*t(""); }else{ JOptionPane.showMessageDialog(null,"密碼與賬戶不匹配,請重新輸入","出錯(cuò)提示",1); accountnum.setTe*t(""); Jpassword.setTe*t(""); }}}/*取款界面*/classTakee*tendsJFrame{publicuttonback;publicuttonclear;publicuttonmit;privateJLabeljL1;publicJTe*tFieldjT1;publicuttonquit; Stringstr="";publicTake(){initponents();this.setLocationRelativeTo(null);this.setVisible(false);}privatevoidinitponents(){jL1=newJLabel();jT1=newJTe*tField();mit=newutton();back=newutton();quit=newutton();clear=newutton();setDefaultCloseOperation(WindowConstants.E*IT_ON_CLOSE);jL1.setTe*t("取款金額:");mit.setTe*t("確定");mit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){mitActionPerformed(evt);}});back.setTe*t("返回");back.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){backActionPerformed(evt);}});quit.setTe*t("退出");quit.addActionListener(newActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){quitActionPerformed(evt);}});clear.setTe*t("去除");clear.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){clearActionPerformed(evt);}});java*.swing.GroupLayoutlayout=newjava*.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(41,41,41).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addponent(jL1).addGap(33,33,33).addponent(jT1,java*.swing.GroupLayout.PREFERRED_SIZE,174,java*.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addponent(clear).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,147,Short.MA*_VALUE).addponent(quit)).addGroup(layout.createSequentialGroup().addponent(mit).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,147,Short.MA*_VALUE).addponent(back))).addContainerGap(69,java*.swing.GroupLayout.PREFERRED_SIZE)));layout.setVerticalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(103,103,103).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(jL1).addponent(jT1,java*.swing.GroupLayout.PREFERRED_SIZE,java*.swing.GroupLayout.DEFAULT_SIZE,java*.swing.GroupLayout.PREFERRED_SIZE)).addGap(61,61,61).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(mit).addponent(back)).addGap(29,29,29).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(clear).addponent(quit)).addContainerGap(65,Short.MA*_VALUE)));pack();}privatevoidclearActionPerformed(ActionEventevt){ str="";jT1.setTe*t(str);}privatevoidquitActionPerformed(ActionEventevt){ load.setVisible(true);this.setVisible(false); }privatevoidbackActionPerformed(ActionEventevt){ Jmain.setVisible(true);this.setVisible(false);}privatevoidmitActionPerformed(ActionEventevt){if(Integer.parseInt(jT1.getTe*t())>0&&Integer.parseInt(jT1.getTe*t())%100==0&&Integer.parseInt(jT1.getTe*t())<=5000){myaccount.deccount(Integer.parseInt(jT1.getTe*t()));intresult=java*.swing.JOptionPane.showConfirmDialog(null,"是否顯示余額?","",java*.swing.JOptionPane.YES_NO_OPTION,java*.swing.JOptionPane.QUESTION_MESSAGE);if(result==java*.swing.JOptionPane.YES_OPTION){dis.set(String.valueOf(myaccount.get()));str=""; jT1.setTe*t(str);dis.setVisible(true);this.setVisible(false);}else{Jmain.setVisible(true);this.setVisible(false);}}else{JOptionPane.showMessageDialog(null,"取款金額不能為負(fù)數(shù)"+"\n取款金額不能為0"+"\n取款金額必須是100的倍數(shù)"+"\n金額一次不能超過5000"+"\n請重新輸入你要取的金額數(shù)","出錯(cuò)提示",1);str="";jT1.setTe*t(str);}}}/*存款界面*/classInpute*tendsJFrame{privateuttonclear;privateuttonmit;privateJLabeljL1;privateJTe*tFieldjT1;Stringstr="";publicInput(){initponents();this.setLocationRelativeTo(null);this.setResizable(false);this.setVisible(false);}privatevoidinitponents(){jL1=newJLabel();jT1=newJTe*tField();mit=newutton();clear=newutton();setDefaultCloseOperation(WindowConstants.E*IT_ON_CLOSE);jL1.setTe*t("存款金額:");mit.setTe*t("確認(rèn)");mit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventevt){mitActionPerformed(evt);}});clear.setTe*t("去除");clear.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){clearActionPerformed(evt);}});java*.swing.GroupLayoutlayout=newjava*.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(47,47,47).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(12,12,12).addponent(mit).addGap(111,111,111).addponent(clear)).addGroup(layout.createSequentialGroup().addponent(jL1).addGap(27,27,27).addponent(jT1,java*.swing.GroupLayout.PREFERRED_SIZE,151,java*.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap(50,Short.MA*_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(88,88,88).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(jL1).addponent(jT1,java*.swing.GroupLayout.PREFERRED_SIZE,java*.swing.GroupLayout.DEFAULT_SIZE,java*.swing.GroupLayout.PREFERRED_SIZE)).addGap(87,87,87).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(clear).addponent(mit)).addContainerGap(88,Short.MA*_VALUE)));pack();}//</editor-fold>privatevoidclearActionPerformed(ActionEventevt){str="";jT1.setTe*t(str);}privatevoidmitActionPerformed(java.awt.event.ActionEventevt){if(Integer.parseInt(jT1.getTe*t())%100==0) {inta=Integer.parseInt(jT1.getTe*t());if(a<0) JOptionPane.showMessageDialog(null,"存款不能為負(fù)數(shù)","出錯(cuò)",1);else myaccount.reccount(a); dis.set(String.valueOf(myaccount.get()));intresult=java*.swing.JOptionPane.showConfirmDialog(null,"是否顯示余額?","",java*.swing.JOptionPane.YES_NO_OPTION,java*.swing.JOptionPane.QUESTION_MESSAGE);if(result==java*.swing.JOptionPane.YES_OPTION){str=""; jT1.setTe*t(str);dis.setVisible(true);this.setVisible(false);}else{Jmain.setVisible(true);this.setVisible(false);} }else { JOptionPane.showMessageDialog(null,"存款金額必須為100的整數(shù)倍!"+"\n請確認(rèn)你的金額","出錯(cuò)提示",1); jT1.setTe*t(""); }}}/*顯示余額界面*/classDisplaye*tendsJFrame{publicuttonback;privateJLabeljL1;publicJTe*tFieldjT1;publicuttonquit;publicuttonqukuan;publicDisplay(){initponents();jT1.setTe*t(String.valueOf(myaccount.get()));this.setLocationRelativeTo(null);this.setVisible(false);}publicvoidset(Stringstr){jT1.setTe*t(str);}privatevoidinitponents(){jL1=newJLabel();jT1=newJTe*tField();quit=newutton();back=newutton();qukuan=newutton();setDefaultCloseOperation(WindowConstants.E*IT_ON_CLOSE);jL1.setTe*t("您的余額為:");jT1.setEditable(false);quit.setTe*t("退出");quit.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){quitActionPerformed(evt);}});back.setTe*t("返回");back.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){backActionPerformed(evt);}});qukuan.setTe*t("取款");qukuan.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){qukuanActionPerformed(evt);}});java*.swing.GroupLayoutlayout=newjava*.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(27,27,27).addponent(jL1).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,java*.swing.GroupLayout.DEFAULT_SIZE,Short.MA*_VALUE).addponent(jT1,java*.swing.GroupLayout.PREFERRED_SIZE,143,java*.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(36,Short.MA*_VALUE)).addGroup(java*.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup().addContainerGap(215,Short.MA*_VALUE).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.TRAILING).addponent(back).addponent(qukuan).addponent(quit)).addContainerGap()));layout.setVerticalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(93,93,93).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.BASELINE).addponent(jL1).addponent(jT1,java*.swing.GroupLayout.PREFERRED_SIZE,java*.swing.GroupLayout.DEFAULT_SIZE,java*.swing.GroupLayout.PREFERRED_SIZE)).addGap(54,54,54).addponent(qukuan).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED).addponent(back).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED).addponent(quit).addContainerGap()));pack();}privatevoidqukuanActionPerformed(ActionEventevt){take.setVisible(true);this.setVisible(false);}privatevoidquitActionPerformed(ActionEventevt){ load.setVisible(true);this.setVisible(false);}privatevoidbackActionPerformed(ActionEventevt){ Jmain.setVisible(true);this.setVisible(false);}}/**修改密碼*/classSetpwe*tendsJFrame{publicuttonmit;publicJLabelmitpw;publicJPasswordFieldjPwmit;publicJPasswordFieldjPwnew;publicJPasswordFieldjPwold;publicJLabelnewpw;publicJLabeloldpw;publicuttonquit;publicSetpw(){initponents();this.setResizable(false);this.setLocationRelativeTo(null);//this.setVisible(false);}privatevoidinitponents(){oldpw=newJLabel();newpw=newJLabel();mitpw=newJLabel();jPwold=newJPasswordField();jPwnew=newJPasswordField();jPwmit=newJPasswordField();mit=newjava*.swing.utton();quit=newjava*.swing.utton();setDefaultCloseOperation(java*.swing.WindowConstants.E*IT_ON_CLOSE);oldpw.setTe*t("舊密碼:");newpw.setTe*t("新密碼:");mitpw.setTe*t("確認(rèn)密碼:");mit.setTe*t("確認(rèn)");mit.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){mitActionPerformed(evt);}});quit.setTe*t("退出");quit.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){quitActionPerformed(evt);}});java*.swing.GroupLayoutlayout=newjava*.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(46,46,46).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING).addponent(oldpw).addponent(newpw).addponent(mitpw)).addGap(25,25,25).addGroup(layout.createParallelGroup(java*.swing.GroupLayout.Alignment.LEADING,false).addGroup(layout.createSequentialGroup().addponent(mit).addPreferredGap(java*.swing.LayoutStyle.ponentPlacement.RELATED,java*.swing.GroupLayout.DEFAULT_SIZE,Short.MA*_VALUE).addponent(quit)).addponent(jPwnew,java*.swing.GroupLayout.DEFAULT_SIZE,180,Short.MA*_VALUE).addponent(jPwold).addponent(jPwmit)).addContainerGap(48,Short.MA*_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 初三生活指南模板
- 財(cái)務(wù)風(fēng)險(xiǎn)管理報(bào)告模板
- 家屬追悼會(huì)致辭范文六篇
- 課程設(shè)計(jì)營銷
- 2024年幼兒園中班語言教案含反思
- 二零二五年度面包磚施工安全生產(chǎn)責(zé)任合同4篇
- 2024年心理咨詢師題庫及完整答案(易錯(cuò)題)
- 二零二五年社區(qū)圖書館圖書采購合同2篇
- 二零二五年度在線教育平臺(tái)學(xué)員免責(zé)協(xié)議書范本4篇
- 高分子防水卷材施工方案
- 第7課《中華民族一家親》(第一課時(shí))(說課稿)2024-2025學(xué)年統(tǒng)編版道德與法治五年級上冊
- 2024年醫(yī)銷售藥銷售工作總結(jié)
- 急診科十大護(hù)理課件
- 山東省濟(jì)寧市2023-2024學(xué)年高一上學(xué)期1月期末物理試題(解析版)
- GB/T 44888-2024政務(wù)服務(wù)大廳智能化建設(shè)指南
- 2025年上半年河南鄭州滎陽市招聘第二批政務(wù)輔助人員211人筆試重點(diǎn)基礎(chǔ)提升(共500題)附帶答案詳解
- 山東省濟(jì)南市歷城區(qū)2024-2025學(xué)年七年級上學(xué)期期末數(shù)學(xué)模擬試題(無答案)
- 國家重點(diǎn)風(fēng)景名勝區(qū)登山健身步道建設(shè)項(xiàng)目可行性研究報(bào)告
- 投資計(jì)劃書模板計(jì)劃方案
- 《接觸網(wǎng)施工》課件 3.4.2 隧道內(nèi)腕臂安裝
- 2024-2025學(xué)年九年級語文上學(xué)期第三次月考模擬卷(統(tǒng)編版)
評論
0/150
提交評論