ATM機(jī)銀行項(xiàng)目java圖形界面_第1頁(yè)
ATM機(jī)銀行項(xiàng)目java圖形界面_第2頁(yè)
ATM機(jī)銀行項(xiàng)目java圖形界面_第3頁(yè)
ATM機(jī)銀行項(xiàng)目java圖形界面_第4頁(yè)
ATM機(jī)銀行項(xiàng)目java圖形界面_第5頁(yè)
已閱讀5頁(yè),還剩12頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

.../登陸packagecom.userland;importjava.awt.HeadlessException;importjava.awt.Label;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;/***歡迎界面*@authorAdministrator**/publicclassWelcomelandextendsJFrame{ JPanelp1; privateJButtonbtn1; Labellabel; staticJframUserLandjf=null; publicWelcomeland<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<800,600>; p1=newJPanel<>; label=newLabel<"XX銀行歡迎登陸!">; btn1=newJButton<"登陸">; btn1.addActionListener<newMyActionListner<>>; p1.add<btn1>; p1.add<label>; setContentPane<p1>; } publicstaticvoidmain<String[]args>{ WelcomelandmyJframe=newWelcomeland<"XX銀行歡迎登陸!">; myJframe.setVisible<true>; } classMyActionListnerimplementsActionListener{ @Override publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn1>{ jf=newJframUserLand<"XX銀行歡迎登陸!">; jf.pack<>; setVisible<false>; jf.setVisible<true>; } } }}packagecom.userland;importjava.awt.Frame;importjava.awt.GridLayout;importjava.awt.HeadlessException;importjava.awt.Label;importjava.awt.event.ActionEvent;stener;importjava.io.BufferedReader;importjava.io.FileInputStream;importjava.io.FileNotFoundException;importjava.io.IOException;importjava.io.InputStreamReader;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JPasswordField;importjavax.swing.JTextField;importcom.action.JframBank;/***登陸界面*@authorAdministrator**/publicclassJframUserLandextendsJFrame{ privateJButtonbtn1,btn2; staticJTextFieldt1; staticJPasswordFieldt2; JPanelp1; publicJframUserLand<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<800,600>; p1=newJPanel<>; Framef=newFrame<"用戶登錄">; f.setLayout<newGridLayout<4,2>>; btn2=newJButton<"確認(rèn)">; btn2.addActionListener<newMyActionListner<>>; t1=newJTextField<"輸入用戶名",15>; t2=newJPasswordField<"輸入密碼",15>; f.add<newLabel<"用戶名:",Label.CENTER>>; p1.add<t1>; f.add<newLabel<"密碼:",Label.CENTER>>; p1.add<t2>; p1.add<btn2>; setContentPane<p1>; this.setVisible<true>; } classMyActionListnerimplementsActionListener{ @Override publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn2>{ InputStreamReaderisr; try{ isr=newInputStreamReader<newFileInputStream< "person.txt">>; BufferedReaderIa=newBufferedReader<isr>; Stringa=Ia.readLine<>; Stringb=Ia.readLine<>; Ia.close<>; System.out.println<JframUserLand.t1.getText<>>; if<JframUserLand.t1.getText<>.equals<a>>{ if<JframUserLand.t2.getText<>.equals<b>>{ JframBankjBank=newJframBank<"XX銀行歡迎登陸!">; jBank.setVisible<true>; jBank.pack<>; setVisible<false>; jBank.setVisible<true>; } }else{ JframUserLandjframUserLand=newJframUserLand< "XX銀行歡迎登陸!">; jframUserLand.setVisible<true>; jframUserLand.pack<>; setVisible<false>; jframUserLand.setVisible<true>; } }catch<FileNotFoundExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; }catch<IOExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; } } } }}packagecom.action;importcom.action.BTN1;and;importjava.awt.HeadlessException;importjava.awt.Window;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JTextField;importjavax.swing.event.DocumentListener;/***主界面*@authorAdministrator**/publicclassJframBankextendsJFrame{ privateBTN1bt1=null; staticBTN2bt2=null; staticBTN3bt3=null; staticBTN4bt4=null; privateJButtonbtn1,btn2,btn3,btn4,btn5; JPanelp1; publicJframBank<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<600,400>; p1=newJPanel<>; btn1=newJButton<"查詢">; btn1.addActionListener<newJ<>>; btn2=newJButton<"取款">; btn2.addActionListener<newJ<>>; btn3=newJButton<"存錢">; btn3.addActionListener<newJ<>>; btn4=newJButton<"轉(zhuǎn)賬">; btn4.addActionListener<newJ<>>; btn5=newJButton<"退出">; btn5.addActionListener<newJ<>>; p1.add<btn1>; p1.add<btn2>; p1.add<btn3>; p1.add<btn4>; p1.add<btn5>; setContentPane<p1>; this.setVisible<true>; } classJimplementsActionListener{ publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn1>{ bt1=newBTN1<"查詢">; bt1.pack<>; setVisible<false>; bt1.setVisible<true>; } if<o==btn2>{ bt2=newBTN2<"取款">; bt2.pack<>; setVisible<false>; bt2.setVisible<true>; } if<o==btn3>{ bt3=newBTN3<"存款">; bt3.pack<>; setVisible<false>; bt3.setVisible<true>; } if<o==btn4>{ bt4=newBTN4<"轉(zhuǎn)賬">; bt4.pack<>; setVisible<false>; bt4.setVisible<true>; } if<o==btn5>{ Welcomelandwel=newWelcomeland<"XX銀行歡迎登陸!">; wel.setVisible<true>; wel.pack<>; setVisible<false>; wel.setVisible<true>; } } } publicBTN1getBt1<>{ returnbt1; }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JTextField;importcom.action.JframBank;importcom.userland.Welcomeland;/***查詢界面**@authorAdministrator**/publicclassBTN1extendsJFrame{ privateJButtonbtn1,btn2; staticJTextFieldt1; privateJPanelb1=newJPanel<>; privateJframBankjfb=null; publicBTN1<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<300,200>; t1=newJTextField<15>; b1.setName<"查詢">; btn1=newJButton<"查詢余額">; btn1.addActionListener<newB<>>; btn2=newJButton<"退出">; btn2.addActionListener<newB<>>; b1.add<btn1>; b1.add<btn2>; b1.add<t1>; setContentPane<b1>; this.setVisible<true>; } publicJTextFieldgetT1<>{ returnt1; } classBimplementsActionListener{ publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn1>{ Queryquery=newQuery<>; query.query<jfb>; } if<o==btn2>{ jfb=newJframBank<"XX銀行歡迎登陸!">; jfb.setVisible<true>; jfb.pack<>; setVisible<false>; } } }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.IOException;importjavax.rmi.CORBA.Tie;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JTextField;importjavax.swing.text.Position.Bias;importcom.action.JframBank;eland;/***取款界面*@authorAdministrator**/publicclassBTN2extendsJFrame{ privateJButtonbtn1,btn2; JTextFieldt1; JPanelb1=newJPanel<>; JframBankjfb=null; publicBTN2<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<300,200>; b1.setName<"取款">; btn1=newJButton<"取款">; btn1.addActionListener<newB<>>; btn2=newJButton<"退出">; btn2.addActionListener<newB<>>; t1=newJTextField<15>; t1.addActionListener<newB<>>; b1.add<btn1>; b1.add<btn2>; b1.add<t1>; setContentPane<b1>; this.setVisible<true>; } classBimplementsActionListener{ publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn1>{// Withdrawwithdraw=newWithdraw<>; try{ Withdraw.Withdrawl<>; }catch<IOExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; } } else{ jfb=newJframBank<"XX銀行歡迎登陸!">; jfb.setVisible<true>; jfb.pack<>; setVisible<false>; jfb.setVisible<true>; } } }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.event.ActionEvent;t.ActionListener;importjavax.rmi.CORBA.Tie;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JTextField;importjavax.swing.text.Position.Bias;importcom.action.JframBank;/***存款界面*@authorAdministrator**/publicclassBTN3extendsJFrame{ privateJButtonbtn1,btn2; JTextFieldt1; JPanelb1=newJPanel<>; JframBankjfb=null; publicBTN3<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<300,200>; b1.setName<"存款">; btn1=newJButton<"存款">; btn1.addActionListener<newB<>>; btn2=newJButton<"退出">; btn2.addActionListener<newB<>>; t1=newJTextField<15>; t1.addActionListener<newB<>>; b1.add<btn1>; b1.add<btn2>; b1.add<t1>; setContentPane<b1>; this.setVisible<true>; } classBimplementsActionListener{ publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn1>{ Savesave=newSave<>; save.save<>; } else{ jfb=newJframBank<"XX銀行歡迎登陸!">; jfb.setVisible<true>; jfb.pack<>; setVisible<false>; jfb.setVisible<true>; } } }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.Label;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.IOException;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JTextField;importcom.action.JframBank;/***轉(zhuǎn)賬界面*@authorAdministrator**/publicclassBTN4extendsJFrame{ privateJLabell1,l2; privateJButtonbtn1,btn2; JTextFieldt1,t2; JPanelb1=newJPanel<>; JframBankjfb=null; publicBTN4<Stringarg0>throwsHeadlessException{ super<arg0>; setSize<150,200>; b1.setName<"轉(zhuǎn)賬">; btn1=newJButton<"轉(zhuǎn)賬">; btn1.addActionListener<newB<>>; btn2=newJButton<"退出">; btn2.addActionListener<newB<>>; l1=newJLabel<"轉(zhuǎn)賬賬號(hào):">; t1=newJTextField<10>; t1.addActionListener<newB<>>; l2=newJLabel<"轉(zhuǎn)賬金額:">; t2=newJTextField<10>; t2.addActionListener<newB<>>; b1.add<btn1>; b1.add<btn2>; b1.add<l1>;; b1.add<t1>; b1.add<l2>; b1.add<t2>; setContentPane<b1>; this.setVisible<true>; } classBimplementsActionListener{ publicvoidactionPerformed<ActionEventarg0>{ Objecto=arg0.getSource<>; if<o==btn1>{ Transfertransfer=newTransfer<>; try{ transfer.Tran<jfb>; }catch<IOExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; } } else{ jfb=newJframBank<"XX銀行歡迎登陸!">; jfb.setVisible<true>; jfb.pack<>; setVisible<false>; jfb.setVisible<true>; } } }}packagecom.action;importjava.io.BufferedReader;importjava.io.BufferedWriter;am;importjava.io.FileNotFoundException;importjava.io.FileReader;importjava.io.FileWriter;importjava.io.IOException;importjava.io.InputStreamReader;importjavax.swing.JTextField;/***查詢*@authorAdministrator**/publicclassQuery{ publicvoidquery<JframBankjframBank>{ try{ BufferedReaderIa=newBufferedReader<newInputStreamReader<newFileInputStream<"1.txt">>>; try{ Stringa=Ia.readLine<>; Ia.close<>; System.out.println<"~~"+a>; BTN1.t1.setText<a>; }catch<IOExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; } }catch<FileNotFoundExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; } }}packagecom.action;eader;importjava.io.BufferedWriter;importjava.io.FileInputStream;importjava.io.FileNotFoundException;importjava.io.FileOutputStream;importjava.io.FileReader;importjava.io.FileWriter;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStream;importjava.io.OutputStreamWriter;/***存款*@authorAdministrator**/publicclassSave{ publicvoidsave<>{ BufferedReaderbr=null; try{ InputStreamReaderisr=newInputStreamReader<newFileInputStream<"1.txt">>; BufferedReaderia=newBufferedReader<isr>; Stringa=ia.readLine<>; Strings=JframBank.bt3.t1.getText<>; ia.close<>; intc=Integer.parseInt<a>;//c數(shù)據(jù)信息對(duì)應(yīng)a原金額 intd=Integer.parseInt<s>; //d數(shù)據(jù)信息對(duì)應(yīng)s 存入金額 if<d>0>{ inte=c+d; Stringf=String.valueOf<e>; //int轉(zhuǎn)換成string System.out.println<"你存入了:"+s+"元">; System.out.println<"你的賬戶余額:"+f>; OutputStreamWriterosw=newOutputStreamWriter<newFileOutputStream<"1.txt">>; BufferedWriterbw=newBufferedWriter<osw>; bw.write<f>; bw.close<>; Savesuccessss=newSavesuccess<"">; ss.setVisible<true>; }else{ WithdraWerrorw=newWithdraWerror<"">; w.setVisible<true>; } }catch<FileNotFoundExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; }catch<IOExceptione>{ //TODOAuto-generatedcatchblock e.printStackTrace<>; } }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.Label;importjavax.swing.JFrame;importjavax.swing.JPanel;publicclassSavesuccessextendsJFrame{ privateJPanelb1=newJPanel<>; Labellabel; publicSavesuccess<Stringarg0>throwsHeadlessException{ setSize<300,200>; label=newLabel<"存款成功,請(qǐng)退出!">; b1.add<label>; setContentPane<b1>; }}packagecom.action;importjava.io.BufferedInputStream;importjava.io.BufferedOutputStream;importjava.io.BufferedReader;importjava.io.DataInputStream;importjava.io.DataOutputStream;importjava.io.FileInputStream;importjava.io.FileNotFoundException;importjava.io.FileOutputStream;importjava.io.FileReader;importjava.io.FileWriter;importjava.io.FilterReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.util.Scanner;importjavax.swing.JTextField;/***轉(zhuǎn)賬*@authorAdministrator**/publicclassTransfer{ publicvoidTran<JframBankjframBank>throwsIOException{ InputStreamReaderisr=newInputStreamReader<newFileInputStream<"1.txt">>; BufferedReaderIa=newBufferedReader<isr>; Stringa=Ia.readLine<>; Ia.close<>; Strings=jframBank.bt4.t1.getText<>;//轉(zhuǎn)賬賬戶 Stringb=jframBank.bt4.t2.getText<>; intd=Integer.parseInt<a>; //d數(shù)據(jù)信息對(duì)應(yīng)a原金額 intc=Integer.parseInt<b>; //c對(duì)應(yīng)為輸入的金額轉(zhuǎn)賬金額 if<c>=0>{ if<d>c>{ inte=d-c; //剩余金額 Stringf=String.valueOf<e>; //int轉(zhuǎn)換成string InputStreamReaderisr2=newInputStreamReader<newFileInputStream<"2.txt">>; BufferedReaderIb=newBufferedReader<isr2>; Stringg=Ib.readLine<>; inth=Integer.parseInt<g>; //把轉(zhuǎn)賬賬號(hào)的金額轉(zhuǎn)成string類型 h=h+c; Stringj=String.valueOf<h>; FileWriterfw=newFileWriter<"1.txt">; fw.write<f>; fw.flush<>; FileWriterfw1=newFileWriter<"2.txt">; fw1.write<j>; fw1.flush<>; Ib.close<>; System.out.println<"你轉(zhuǎn)賬:"+b>; TransferSuccessts=newTransferSuccess<"">; ts.setVisible<true>; } else{ TransferErrortr=newTransferError<"">; tr.setVisible<true>; } }else{ WithdraWerrorwi=newWithdraWerror<"">; wi.setVisible<true>; } }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.Label;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;importcom.action.JframBank.J;publicclassTransferErrorextendsJFrame{ privateJPanelb1=newJPanel<>; Labellabel; privateJButtonbtn1; publicTransferError<Stringarg0>throwsHeadlessException{ setSize<300,200>; label=newLabel<"存款成功,請(qǐng)退出!">; b1.add<label>; setContentPane<b1>; }}packagecom.action;importjava.awt.HeadlessException;importjava.awt.Label;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JPanel;publicclassTransferSuccessextendsJFrame{ privateJPanelb1=newJPanel<>; Labellabel; privateJButtonbtn1; publicTransferSuccess<Stringarg0>throwsHeadlessException{ setSize<300,200>; label=newLabel<"轉(zhuǎn)賬成功,請(qǐng)退出!">; b1.add<label>; setContentPane<b1>; }}packagecom.action;importjava.io.BufferedReader;importjava.io.FileInpu

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論