Java测试的题目代码提交

---恢复内容开始---

日期:2018.9.24

星期一

博客期:011

 

  上周四,我们软工专业进行了软件测试!相关题目如下:

  

一、测试要求:

 

1、按照测试内容要求完成程序的设计与编程;

2、建立学号姓名文件夹,如:“信1705-1班20173425陈欢”,将源程序文件、accountinformation.txt、accountlist.txt保存在文件夹中,压缩成rar文件提交。

3、以班级为单位上交最终考试结果。

 

二、 数据结构测试要求:(8分)

 

ATM机的账户记录Account有账户的唯一性标识(8个数字的组合),用户的姓名,操作日期(Date),操作类型,账户密码(六位的数字,可以用0开头),当前的余额(可以为0)。

1、定义Account类,其中包括七个私有变量(accountID,accountname,operatedate,operatetype,accountpassword, accountbalance,)。(3分)

各成员的含义如下:

变量accountID为字符串类型String,用于存储学生的用户账号(由八位数字组成)。

变量accountname为字符串类型String,用于存储账户的名称。

变量operatedate为字符串类型String,用于存储操作的时间,由十位字符组成,显示格式为“2018-09-20”。   

变量operatetype为int类型,用于存储操作账户的类型,具体描述为“1”表示存款,“2”表示取款,“3”表示转账汇款,“4”表示修改账户密码,“5”表示查询余额。

变量accountpassword为字符串类型String,用于用户密码,由六位数字组成。

变量accountbalance为整数类型int,用于存储账户余额,缺省为0。

变量amount为整数类型int,表示操作流水金额。

 

2、对每个变量定义get()(读取变量信息)和set()(设置变量信息)的方法。(3分)

3、定义accountinformation.txt作为账户基本信息库,基本信息包括accountID,accountname,accountpassword, accountbalance,要求事先实现至少存储五个账户的信息,定义accountlist.txt作为账户操作流水信息数据库,操作流水信息包括(accountID,accountname,operatedate,operatetype, amount)。(要求将学号作为帐号,将考生信息作为第一条记录)。(2分)

   当然还有其他要求,等我把一些隐讳信息删去,就可以发到我的博客上去了!本段代码分成两个部分,我先写第一部分,这一部分是控制台执行的,所以简单一点,就700多行加一个Account类,第二部分我做的是窗口执行的,代码量要求较多,2000行以上,只是Account类是共用的我就不写了先截图说明

     

  可能排版不是特别好,不过代码还可以啦!!!代码如下:

  下面这个是Account.java文件

  1 package test;
  2 
  3 public class Account {
  4     //----------------<内部成员>-----------------//
  5     //学生的用户账号
  6     /*(由八位数字组成)*/
  7     private String accountID;
  8     //学生的姓名
  9     private String accountname;
 10     //操作的时间
 11     /*格式为“2018-09-20”*/
 12     private String operatedate;
 13     //操作账户的类型
 14     /*“1”表示存款
 15      * “2”表示取款
 16      * “3”表示转账汇款
 17      * “4”表示修改账户密码
 18      * “5”表示查询余额
 19      */
 20     private int operatetype;
 21     //用户密码
 22     /*6位*/
 23     private String accountpassword;
 24     //账户余额
 25     private int accountbalance;
 26     //流水金额
 27     private int amount;
 28     //----------------<T函数>-----------------//
 29     //Set函数
 30     public void SetaccountID(String x){
 31         accountID = x;
 32     }
 33     public void Setaccountname(String x){
 34         accountname = x;
 35     }
 36     public void Setoperatedate(String x){
 37         operatedate = x;
 38     }
 39     public void Setoperatetype(int x){
 40         operatetype = x;
 41     }
 42     public void Setaccountpassword(String x){
 43         accountpassword = x;
 44     }
 45     public void Setaccountbalance(int x){
 46         accountbalance = x;
 47     }
 48     public void Setamount(int x){
 49         amount = x;
 50     }
 51     public void Set(String id,String name,String date,int type,String password,int balance,int amount_s){
 52         SetaccountID(id);
 53         Setaccountname(name);
 54         Setoperatedate(date);
 55         Setoperatetype(type);
 56         Setaccountpassword(password);
 57         Setaccountbalance(balance);
 58         Setamount(amount_s);
 59     }
 60     //Get函数
 61     public String GetaccountID(){
 62         return accountID;
 63     }
 64     public String Getaccountname(){
 65         return accountname;
 66     }
 67     public String Getoperatedate(){
 68         return operatedate;
 69     }
 70     public int Getoperatetype(){
 71         return operatetype;
 72     }
 73     public String Getaccountpassword(){
 74         return accountpassword;
 75     }
 76     public int Getaccountbalance(){
 77         return accountbalance;
 78     }
 79     public int Getamount(){
 80         return amount;
 81     }
 82     //Reset函数
 83     public void Reset(){
 84         amount = 0;
 85         accountbalance = 0;
 86         accountpassword = "LaoShiNiHaoA!";
 87         operatetype = 0;
 88         operatedate = "2017-09-10";
 89         accountname = "WoShiXueZha";
 90         accountID = "20173561";
 91     }
 92     //----------------<附加函数>-----------------//
 93     //判断是否ID格式正确
 94     public boolean RightId(){
 95         
 96         return true;
 97     }
 98     //----------------<构造函数>-----------------//
 99     public Account(){
100         amount = 0;
101         accountbalance = 0;
102         accountpassword = "LaoShiNiHaoA!";
103         operatetype = 0;
104         operatedate = "2017-09-10";
105         accountname = "WoShiXueZha";
106         accountID = "20173561";
107     }
108     //----------------<主函数>-----------------//
109     public static void main(String[] args) {
110         System.out.println("本程序为基础设置程序!");
111     }
112 }

  下面这个是AccountManger类

  1 package test;
  2 
  3 import java.io.BufferedWriter;
  4 import java.io.File;
  5 import java.io.FileNotFoundException;
  6 import java.io.FileReader;
  7 import java.io.FileWriter;
  8 import java.io.IOException;
  9 import java.io.PrintWriter;
 10 import java.util.Scanner;
 11 
 12 public class AccountManager {
 13     //----------------<数据库>-----------------//
 14     //数据组
 15     private Account ku[] = new Account[5];
 16     //记录名称
 17     private String Infor = "files/accountinformation.txt";
 18     private String List = "files/accountlist.txt";
 19     private String Today = "2018-9-20";
 20     //----------------<界面函数>---------------//
 21     //初始界面
 22     public void FirstWin() throws IOException{
 23         System.out.println("***************************************************************");
 24         System.out.println("              欢迎使用中国工商银行自动柜员系统");
 25         System.out.println("***************************************************************");
 26         System.out.println("                    请输入您的账号:");
 27         Scanner sc = new Scanner(System.in);
 28         String x = sc.next();
 29         int existfor = 5;//此处用于测试是否账号不存在
 30         for(int i=0;i<5;i++)//检测数组中是否存有该数据!
 31             if(ku[i].GetaccountID().compareTo(x)==0)
 32             {
 33                 existfor = i;
 34                 break;
 35             }
 36         if(existfor==5)
 37         {
 38             System.out.println(" #:该卡不是工行卡!");
 39             FirstWin();
 40         }
 41         else
 42             SecondWin(existfor);
 43     
 44     }
 45     //密码输入界面
 46     public void SecondWin(int pass) throws IOException{
 47         System.out.println("***************************************************************");
 48         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
 49         System.out.println("***************************************************************");
 50         System.out.println("                    请输入您的密码:");
 51         int times = 0;//记录输入密码的次数
 52         Scanner sc = new Scanner (System.in);
 53         while(times<3){
 54             String saving = sc.nextLine();
 55             if(ku[pass].Getaccountpassword().compareTo(saving)!=0)
 56                 System.out.println("密码录入错误");
 57             else
 58                 break;
 59             times++;
 60         }
 61         if(times==3)
 62             FirstWin();
 63         else
 64             MainWin(pass);
 65     }
 66     //主界面
 67     void MainWin(int pass) throws IOException{
 68         System.out.println("***************************************************************");
 69         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
 70         System.out.println("****************************************************************");
 71         System.out.println("                    1、存款;");
 72         System.out.println("                    2、取款;");
 73         System.out.println("                    3、转账汇款;");
 74         System.out.println("                    4、修改密码;");
 75         System.out.println("                    5、查询金额;");
 76         System.out.println("****************************************************************");
 77         System.out.println("                      请输入:");
 78         Scanner sc = new Scanner (System.in);
 79         int temp = sc.nextInt();
 80         switch(temp)
 81         {
 82         case 1:ku[pass].Setoperatetype(1);writefile();fun1(pass);break;
 83         case 2:ku[pass].Setoperatetype(2);writefile();fun2(pass);break;
 84         case 3:ku[pass].Setoperatetype(3);writefile();fun3(pass);break;
 85         case 4:ku[pass].Setoperatetype(4);writefile();fun4(pass);break;
 86         case 5:ku[pass].Setoperatetype(5);writefile();fun5(pass);break;
 87         default:MainWin(pass);break;
 88         }
 89     }
 90     //存款界面
 91     public void fun1(int pass) throws IOException{
 92         System.out.println("***************************************************************");
 93         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
 94         System.out.println("****************************************************************");
 95         System.out.println("                 请输入存款金额;");
 96         Scanner sc = new Scanner (System.in);
 97         if(sc.hasNext("q"))
 98             FirstWin();
 99         else
100         {
101             int JinE = sc.nextInt();//记录金额
102             if(JinE<=0)
103             {
104                 System.out.println(" #:输入金额有误");
105                 fun1(pass);
106             }
107             else
108             {
109                 ku[pass].Setamount(ku[pass].Getamount()+JinE);
110                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()+JinE);
111                 //-----------------------[数据载入文档]
112                 System.out.println("***************************************************************");
113                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
114                 System.out.println("****************************************************************");
115                 System.out.println("                当前账户存款操作成功。");
116                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
117                 //----------------------------------------------------<以下为文件更新阶段
118                 Scanner scs = new Scanner (new FileReader(List));
119                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
120                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
121                 {
122                     pws.println(scs.nextLine());
123                 }
124                 pws.println(scs.nextLine());
125                 pws.close();
126                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
127                 PrintWriter pw = new PrintWriter (new FileWriter(List));
128                 pw.print(ku[pass].GetaccountID());
129                 pw.print(" ");
130                 pw.print(Today);
131                 ku[pass].Setoperatedate(Today);
132                 pw.print(" ");
133                 pw.print("SaveMoney");
134                 pw.print(" ");
135                 pw.println(JinE);
136                 while(!scp.hasNext("ENDOFTHISFILE"))
137                 {
138                     pw.println(scp.nextLine());
139                 }
140                 pw.println(scp.nextLine());
141                 pw.close();
142                 writefile();
143                 //----------------------------------------
144                 MainWin(pass);
145             }
146         }        
147     }
148     //取款界面
149     public void fun2(int pass) throws IOException{
150         System.out.println("***************************************************************");
151         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
152         System.out.println("****************************************************************");
153         System.out.println("                 当前账户每日可以支取2万元。");
154         System.out.println("                         1、100元");
155         System.out.println("                         2、500元");
156         System.out.println("                         3、1000元");
157         System.out.println("                         4、1500元");
158         System.out.println("                         5、2000元");
159         System.out.println("                         6、5000元;");
160         System.out.println("                         7、其他金额");
161         System.out.println("                         8、退卡");
162         System.out.println("                         9、返回");
163         System.out.println("****************************************************************");
164         System.out.println("                        #:请选择");
165         Scanner sc = new Scanner (System.in);
166         int choice = sc.nextInt();
167         switch(choice){
168         case 1:
169         {
170             if(ku[pass].Getaccountbalance()<100)
171             {
172                 System.out.println("账户余额不足");
173                 fun2(pass);
174             }
175             else
176             {
177                 ku[pass].Setamount(ku[pass].Getamount()+100);
178                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-100);
179                 System.out.println("***************************************************************");
180                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
181                 System.out.println("****************************************************************");
182                 System.out.println("             当前账户取款操作100元成功。");
183                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
184                 //----------------------------------------------------<以下为文件更新阶段
185                 Scanner scs = new Scanner (new FileReader(List));
186                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
187                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
188                 {
189                     pws.println(scs.nextLine());
190                 }
191                 pws.println(scs.nextLine());
192                 pws.close();
193                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
194                 PrintWriter pw = new PrintWriter (new FileWriter(List));
195                 pw.print(ku[pass].GetaccountID());
196                 pw.print(" ");
197                 pw.print(Today);
198                 ku[pass].Setoperatedate(Today);
199                 pw.print(" ");
200                 pw.print("GetMoney");
201                 pw.print(" ");
202                 pw.println(100);
203                 while(!scp.hasNext("ENDOFTHISFILE"))
204                 {
205                     pw.println(scp.nextLine());
206                 }
207                 pw.println(scp.nextLine());
208                 pw.close();
209                 writefile();
210                 //-----------------------------------
211                 MainWin(pass);
212             }
213             break;
214         }
215         case 2:
216         {
217             if(ku[pass].Getaccountbalance()<500)
218             {
219                 System.out.println("账户余额不足");
220                 fun2(pass);
221             }
222             else
223             {
224                 ku[pass].Setamount(ku[pass].Getamount()+500);
225                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-500);
226                 System.out.println("***************************************************************");
227                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
228                 System.out.println("****************************************************************");
229                 System.out.println("             当前账户取款操作500元成功。");
230                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
231                 //----------------------------------------------------<以下为文件更新阶段
232                 Scanner scs = new Scanner (new FileReader(List));
233                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
234                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
235                 {
236                     pws.println(scs.nextLine());
237                 }
238                 pws.println(scs.nextLine());
239                 pws.close();
240                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
241                 PrintWriter pw = new PrintWriter (new FileWriter(List));
242                 pw.print(ku[pass].GetaccountID());
243                 pw.print(" ");
244                 pw.print(Today);
245                 ku[pass].Setoperatedate(Today);
246                 pw.print(" ");
247                 pw.print("GetMoney");
248                 pw.print(" ");
249                 pw.println(500);
250                 while(!scp.hasNext("ENDOFTHISFILE"))
251                 {
252                     pw.println(scp.nextLine());
253                 }
254                 pw.println(scp.nextLine());
255                 pw.close();
256                 writefile();
257                 //-----------------------------------
258                 MainWin(pass);
259             }
260             break;
261         }
262         case 3:
263         {
264             if(ku[pass].Getaccountbalance()<1000)
265             {
266                 System.out.println("账户余额不足");
267                 fun2(pass);
268             }
269             else
270             {
271                 ku[pass].Setamount(ku[pass].Getamount()+1000);
272                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-1000);
273                 System.out.println("***************************************************************");
274                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
275                 System.out.println("****************************************************************");
276                 System.out.println("             当前账户取款操作1000元成功。");
277                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
278                 //----------------------------------------------------<以下为文件更新阶段
279                 Scanner scs = new Scanner (new FileReader(List));
280                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
281                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
282                 {
283                     pws.println(scs.nextLine());
284                 }
285                 pws.println(scs.nextLine());
286                 pws.close();
287                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
288                 PrintWriter pw = new PrintWriter (new FileWriter(List));
289                 pw.print(ku[pass].GetaccountID());
290                 pw.print(" ");
291                 pw.print("GetMoney");
292                 pw.print(" ");
293                 pw.println(1000);
294                 while(!scp.hasNext("ENDOFTHISFILE"))
295                 {
296                     pw.println(scp.nextLine());
297                 }
298                 pw.println(scp.nextLine());
299                 pw.close();
300                 //-----------------------------------
301                 MainWin(pass);
302             }
303             break;
304         }
305         case 4:
306         {
307             if(ku[pass].Getaccountbalance()<1500)
308             {
309                 System.out.println("账户余额不足");
310                 fun2(pass);
311             }
312             else
313             {
314                 ku[pass].Setamount(ku[pass].Getamount()+1500);
315                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-1500);
316                 System.out.println("***************************************************************");
317                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
318                 System.out.println("****************************************************************");
319                 System.out.println("             当前账户取款操作1500元成功。");
320                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
321                 //----------------------------------------------------<以下为文件更新阶段
322                 Scanner scs = new Scanner (new FileReader(List));
323                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
324                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
325                 {
326                     pws.println(scs.nextLine());
327                 }
328                 pws.println(scs.nextLine());
329                 pws.close();
330                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
331                 PrintWriter pw = new PrintWriter (new FileWriter(List));
332                 pw.print(ku[pass].GetaccountID());
333                 pw.print(" ");
334                 pw.print(Today);
335                 ku[pass].Setoperatedate(Today);
336                 pw.print(" ");
337                 writefile();
338                 pw.print("GetMoney");
339                 pw.print(" ");
340                 pw.println(1500);
341                 while(!scp.hasNext("ENDOFTHISFILE"))
342                 {
343                     pw.println(scp.nextLine());
344                 }
345                 pw.println(scp.nextLine());
346                 pw.close();
347                 //-----------------------------------
348                 MainWin(pass);
349             }
350             break;
351         }
352         case 5:
353         {
354             if(ku[pass].Getaccountbalance()<2000)
355             {
356                 System.out.println("账户余额不足");
357                 fun2(pass);
358             }
359             else
360             {
361                 ku[pass].Setamount(ku[pass].Getamount()+2000);
362                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-2000);
363                 System.out.println("***************************************************************");
364                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
365                 System.out.println("****************************************************************");
366                 System.out.println("             当前账户取款操作2000元成功。");
367                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
368                 //----------------------------------------------------<以下为文件更新阶段
369                 Scanner scs = new Scanner (new FileReader(List));
370                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
371                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
372                 {
373                     pws.println(scs.nextLine());
374                 }
375                 pws.println(scs.nextLine());
376                 pws.close();
377                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
378                 PrintWriter pw = new PrintWriter (new FileWriter(List));
379                 pw.print(ku[pass].GetaccountID());
380                 pw.print(" ");
381                 pw.print(Today);
382                 ku[pass].Setoperatedate(Today);
383                 pw.print(" ");
384                 writefile();
385                 pw.print("GetMoney");
386                 pw.print(" ");
387                 pw.println(2000);
388                 while(!scp.hasNext("ENDOFTHISFILE"))
389                 {
390                     pw.println(scp.nextLine());
391                 }
392                 pw.println(scp.nextLine());
393                 pw.close();
394                 //-----------------------------------
395                 MainWin(pass);
396             }
397             break;
398         }
399         case 6:
400         {
401             if(ku[pass].Getaccountbalance()<5000)
402             {
403                 System.out.println("账户余额不足");
404                 fun2(pass);
405             }
406             else
407             {
408                 ku[pass].Setamount(ku[pass].Getamount()+5000);
409                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-5000);
410                 System.out.println("***************************************************************");
411                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
412                 System.out.println("****************************************************************");
413                 System.out.println("             当前账户取款操作5000元成功。");
414                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
415                 //----------------------------------------------------<以下为文件更新阶段
416                 Scanner scs = new Scanner (new FileReader(List));
417                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
418                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
419                 {
420                     pws.println(scs.nextLine());
421                 }
422                 pws.println(scs.nextLine());
423                 pws.close();
424                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
425                 PrintWriter pw = new PrintWriter (new FileWriter(List));
426                 pw.print(ku[pass].GetaccountID());
427                 pw.print(" ");
428                 pw.print(Today);
429                 ku[pass].Setoperatedate(Today);
430                 pw.print(" ");
431                 writefile();
432                 pw.print("GetMoney");
433                 pw.print(" ");
434                 pw.println(5000);
435                 while(!scp.hasNext("ENDOFTHISFILE"))
436                 {
437                     pw.println(scp.nextLine());
438                 }
439                 pw.println(scp.nextLine());
440                 pw.close();
441                 //-----------------------------------
442                 MainWin(pass);
443             }
444             break;
445         }
446         case 7:
447         {
448             System.out.println("***************************************************************");
449             System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
450             System.out.println("****************************************************************");
451             System.out.println("                请输入取款金额:");
452             int num = sc.nextInt();
453             if(ku[pass].Getaccountbalance()<num)
454             {
455                 System.out.println("账户余额不足");
456                 fun2(pass);
457             }
458             else
459             {
460                 ku[pass].Setamount(ku[pass].Getamount()+num);
461                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-num);
462                 System.out.println("***************************************************************");
463                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
464                 System.out.println("****************************************************************");
465                 System.out.println("             当前账户取款操作"+num+"元成功。");
466                 System.out.println("             当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
467                 writefile();
468                 //----------------------------------------------------<以下为文件更新阶段
469                 Scanner scs = new Scanner (new FileReader(List));
470                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
471                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
472                 {
473                     pws.println(scs.nextLine());
474                 }
475                 pws.println(scs.nextLine());
476                 pws.close();
477                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
478                 PrintWriter pw = new PrintWriter (new FileWriter(List));
479                 pw.print(ku[pass].GetaccountID());
480                 pw.print(" ");
481                 pw.print(Today);
482                 ku[pass].Setoperatedate(Today);
483                 pw.print(" ");
484                 writefile();
485                 pw.print("GetMoney");
486                 pw.print(" ");
487                 pw.println(num);
488                 while(!scp.hasNext("ENDOFTHISFILE"))
489                 {
490                     pw.println(scp.nextLine());
491                 }
492                 pw.println(scp.nextLine());
493                 pw.close();
494                 //-----------------------------------
495                 MainWin(pass);
496             }
497             break;
498         }
499         case 8:
500         {
501             FirstWin();
502             break;
503         }
504         case 9:
505         {
506             MainWin(pass);
507             break;
508         }
509         default:fun2(pass);break;
510         }
511     }
512     //转账汇款界面
513     public void fun3(int pass) throws IOException{
514         System.out.println("***************************************************************");
515         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
516         System.out.println("***************************************************************");
517         System.out.println("                     请输入转账账户;");
518         Scanner sc = new Scanner (System.in);
519         if(sc.hasNext("q"))
520             FirstWin();
521         String temp = sc.next();
522         int tube = 5;//记录账户
523         for(int i=0;i<5;i++){
524             if(ku[i].GetaccountID().compareTo(temp)==0)
525             {
526                 tube = i;
527                 break;
528             }
529         }
530         if(tube==5)
531         {
532             System.out.println(" #:该用户不存在");
533             fun3(pass);
534         }
535         else
536         {
537             fun3_half(pass,tube);
538         }
539     }
540     public void fun3_half(int pass,int pass_to) throws IOException{
541         System.out.println("***************************************************************");
542         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
543         System.out.println("***************************************************************");
544         System.out.println("                   请输入转账金额;");
545         Scanner sc = new Scanner (System.in);
546         if(sc.hasNext("q"))
547             FirstWin();
548         int JinE= sc.nextInt();
549         if(JinE>ku[pass].Getaccountbalance())
550         {
551             System.out.println("账户余额不足");
552             fun3_half(pass,pass_to);
553         }
554         else if(JinE<=0)
555             fun3_half(pass,pass_to);
556         else
557         {
558             StringBuffer sxw = new StringBuffer(ku[pass_to].Getaccountname());
559             sxw.deleteCharAt(0);
560             System.out.println("***************************************************************");
561             System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
562             System.out.println("***************************************************************");
563             System.out.println("          请确认是否向*"+sxw+"转账"+JinE+"元。");
564             String makesure = sc.next();
565             if(sc.hasNext("q"))
566                 FirstWin();
567             if(makesure.compareTo("Y")==0)
568             {
569                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-JinE);
570                 ku[pass].Setamount(ku[pass].Getamount()+JinE);
571                 ku[pass_to].Setaccountbalance(ku[pass_to].Getaccountbalance()+JinE);
572                 ku[pass_to].Setamount(ku[pass_to].Getamount()+JinE);
573                 System.out.println("***************************************************************");
574                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
575                 System.out.println("***************************************************************");
576                 System.out.println("          当前账户向*"+sxw+"转账"+JinE+"元。");
577                 System.out.println("          当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
578             }
579             //----------------------------------------------------<以下为文件更新阶段
580             Scanner scs = new Scanner (new FileReader(List));
581             PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
582             while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
583             {
584                 pws.println(scs.nextLine());
585             }
586             pws.println(scs.nextLine());
587             pws.close();
588             Scanner scp = new Scanner (new FileReader("files/LinShi"));
589             PrintWriter pw = new PrintWriter (new FileWriter(List));
590             pw.print(ku[pass].GetaccountID());
591             pw.print(" ");
592             pw.print(Today);
593             ku[pass].Setoperatedate(Today);
594             pw.print(" ");
595             writefile();
596             pw.print("RemoveMoney");
597             pw.print(" ");
598             pw.println(JinE);
599             while(!scp.hasNext("ENDOFTHISFILE"))
600             {
601                 pw.println(scp.nextLine());
602             }
603             pw.println(scp.nextLine());
604             pw.close();
605             //-----------------------------------
606             MainWin(pass);
607         }
608     }
609     //修改密码界面
610     public void fun4(int pass) throws IOException{
611         System.out.println("***************************************************************");
612         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
613         System.out.println("***************************************************************");
614         String str1,str2;
615         System.out.println("                  请输入当前密码:  ");
616         Scanner sc = new Scanner (System.in);
617         str1 = sc.next();
618         if(sc.hasNext("q"))
619             FirstWin();
620         if(ku[pass].Getaccountpassword().compareTo(str1)==0)
621         {
622             System.out.println("                  请输入修改密码:");
623             str1 = sc.next();
624             if(sc.hasNext("q"))
625                 FirstWin();
626             System.out.println("                  请输入确认密码:");
627             str2 = sc.next();
628             if(sc.hasNext("q"))
629                 FirstWin();
630             if(str1.compareTo(str2)==0)
631             {
632                 ku[pass].Setaccountpassword(str1);
633                 writefile();
634                 System.out.println("***************************************************************");
635                 System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
636                 System.out.println("***************************************************************");
637                 System.out.println("           当前账户密码修改成功");
638                 //----------------------------------------------------<以下为文件更新阶段
639                 Scanner scs = new Scanner (new FileReader(List));
640                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
641                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
642                 {
643                     pws.println(scs.nextLine());
644                 }
645                 pws.println(scs.nextLine());
646                 pws.close();
647                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
648                 PrintWriter pw = new PrintWriter (new FileWriter(List));
649                 pw.print(ku[pass].GetaccountID());
650                 pw.print(" ");
651                 pw.print(Today);
652                 ku[pass].Setoperatedate(Today);
653                 pw.print(" ");
654                 writefile();
655                 pw.print("ChangePassword");
656                 pw.print(" ");
657                 pw.println("**********");
658                 while(!scp.hasNext("ENDOFTHISFILE"))
659                 {
660                     pw.println(scp.nextLine());
661                 }
662                 pw.println(scp.nextLine());
663                 pw.close();
664                 //-----------------------------------
665                 MainWin(pass);
666             }
667             else
668             {
669                 System.out.println("          修改密码与确认密码不一致");
670                 fun4(pass);
671             }
672         }
673         else
674         {
675             System.out.println("         当前密码录入错误");
676             fun4(pass);
677         }
678     }
679     //查询金额界面
680     public void fun5(int pass) throws IOException{
681         System.out.println("***************************************************************");
682         System.out.println("   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统");
683         System.out.println("***************************************************************");
684         System.out.println("                  当前账户余额为:"+ku[pass].Getaccountbalance()+"元");
685         System.out.println("                    账户清单信息为:");
686         int sx = 1;
687         Scanner sl = new Scanner (new File(List));
688         while(true)
689         {
690             String str3 = sl.next();//账户
691             if(str3.compareTo("ENDOFTHISFILE")==0)
692                 break;
693             String str1 = sl.next();//日期
694             String str2 = sl.next();//操作类型
695             String dateofthis = sl.next();//操作金额
696             if(ku[pass].GetaccountID().compareTo(str3)==0)
697             {
698                 System.out.println(sx+"、"+str1+"  "+str2+"   "+dateofthis);
699                 sx++;
700             }
701         }
702         MainWin(pass);
703     }
704     //----------------<构造函数>---------------//
705     public AccountManager() throws FileNotFoundException{
706         for(int i=0;i<5;i++)
707             ku[i] = new Account();
708         readfile();
709     }
710     //写入
711     public void writefile() throws IOException{
712         FileWriter fr = new FileWriter(Infor);
713         BufferedWriter bw = new BufferedWriter(fr);
714         PrintWriter fl = new PrintWriter(bw);
715         for(int i =0;i<5;i++)
716         {
717             fl.print(ku[i].GetaccountID());
718             fl.print(' ');
719             fl.print(ku[i].Getaccountname());
720             fl.print(' ');
721             fl.print(ku[i].Getoperatedate());
722             fl.print(' ');
723             fl.print(ku[i].Getoperatetype());
724             fl.print(' ');
725             fl.print(ku[i].Getaccountpassword());
726             fl.print(' ');
727             fl.print(ku[i].Getaccountbalance());
728             fl.print(' ');
729             fl.print(ku[i].Getamount());
730             fl.print("\n");
731         }
732         fl.close();
733     }
734     //读入
735     public void readfile() throws FileNotFoundException{
736         Scanner fl = new Scanner(new File(Infor));
737         for(int i=0;i<5;i++)
738             ku[i].Set(fl.next(),fl.next(),fl.next(),fl.nextInt(),fl.next(),fl.nextInt(),fl.nextInt());
739     }
740     //----------------<主函数>-----------------//
741     public static void main(String[] args) throws IOException {
742         AccountManager ap = new AccountManager();
743         ap.FirstWin();
744     }
745 }

  下面的程序大家可以不看了,是Test100.java文件,是实现了窗口的java应用程序!

   1 package th921;
   2 
   3 import java.awt.Choice;
   4 import java.awt.Container;
   5 import java.awt.FlowLayout;
   6 import java.awt.event.ActionEvent;
   7 import java.awt.event.ActionListener;
   8 import java.io.BufferedWriter;
   9 import java.io.File;
  10 import java.io.FileNotFoundException;
  11 import java.io.FileReader;
  12 import java.io.FileWriter;
  13 import java.io.IOException;
  14 import java.io.PrintWriter;
  15 import java.util.Calendar;
  16 import java.util.Scanner;
  17 
  18 import javax.swing.ButtonGroup;
  19 import javax.swing.ImageIcon;
  20 import javax.swing.JButton;
  21 import javax.swing.JFrame;
  22 import javax.swing.JLabel;
  23 import javax.swing.JPanel;
  24 import javax.swing.JRadioButton;
  25 import javax.swing.JTextField;
  26 
  27 public class Test100{
  28     //-------------------<重要数据存储>------------------------//
  29     //-----------------------------------------------------------------[杂项存储]
  30     //---[账户存储区]
  31     private Account ku[] = new Account[5]; 
  32     //---[背景图片]
  33     //Windows............................................白色风格
  34     private String Wins1 = "files/Windows.jpg";
  35     //Windows2...........................................灰色风格
  36     //private String Wins2 = "files/Windows2.jpg";
  37     //Windows3...........................................蓝色风格
  38     //private String Wins3 = "files/Windows3.jpg";
  39     //Windows4...........................................蓝色风格
  40     //private String Wins4 = "files/Windows4.jpg";
  41     //---[用于界面的图片]
  42     private ImageIcon Win = new ImageIcon(Wins1);
  43     //---[记录名称]
  44     //账户数据文件
  45     private String Infor = "files/accountinformation.txt";
  46     //账户操作记录文件
  47     private String List = "files/accountlist.txt";
  48     //今天的日期(可修改)
  49     private String Today = "2018-9-24";
  50     //---[记录第几条]
  51     private int TextOfThis = 1;
  52     //转账的用户
  53     private int temporay = -1;
  54     //记录输入密码的次数
  55     private int times = 0;
  56     //记录是否导入过账户窗口
  57     private int times1 = 0;
  58     //记录是否导入过密码窗口
  59     private int times2 = 0;
  60     //记录是否导入过主窗口
  61     private int times3 = 0;
  62     //记录是否导入过存款窗口
  63     private int times4 = 0;
  64     //记录是否导入过取款窗口
  65     private int times5 = 0;
  66     //记录是否导入过转账窗口
  67     private int times6 = 0;
  68     //记录是否导入过修改密码界面
  69     private int times7 = 0;
  70     //记录是否导入过查询界面
  71     private int times8 = 0;
  72     //存入是否转账
  73     private boolean ifyes = true;
  74     //转账金额
  75     private int tubes;
  76     //进入的账户为
  77     private int pass = 0;
  78     //-----------------------------------------------------------------[写入框]
  79     //第一个数据的写入
  80     final JTextField jt1 = new JTextField(10);
  81     //第二个数据的写入
  82     final JTextField jt2 = new JTextField(10);
  83     //存款金额的写入
  84     final JTextField jt3 = new JTextField(10);
  85     //取款金额的写入
  86     final JTextField jt4 = new JTextField(6);
  87     //转账金额的写入
  88     final JTextField jt5 = new JTextField(10);
  89     //查询金额——数据的读入
  90     final JTextField jt6 = new JTextField(25);
  91     //密码写入
  92     final JTextField jt7 = new JTextField(10);
  93     final JTextField jt7s = new JTextField(10);
  94     final JTextField jt7t = new JTextField(10);
  95     //-----------------------------------------------------------------[按钮]
  96     //第一个窗口的按钮=======<输入账号界面>
  97     private JButton bfw = new JButton("确定");
  98     //第二个窗口的按钮=======<输入密码界面>
  99     private JButton bsw = new JButton("确定");
 100     //第三个窗口的按钮=======<主界面>
 101     private JButton bmw = new JButton("确定");
 102     //第四个窗口的按钮=======<存款>
 103     private JButton b1 = new JButton("确定");
 104     private JButton b1s = new JButton("确定");
 105     //第五个窗口的按钮=======<取款>
 106     private JButton b2 = new JButton("确定");
 107     private JButton b2s = new JButton("确定");
 108     private JButton b2t = new JButton("确定");
 109     //第六个窗口的按钮=======<转账汇款>
 110     private JButton b3 = new JButton ("确定");
 111     private JButton b3s = new JButton ("确定");
 112     private JButton b3t = new JButton("确定");
 113     private JButton b3f = new JButton ("确定");
 114     //第七个窗口的按钮=======<修改密码>
 115     private JButton b4 = new JButton("确定");
 116     private JButton b4s = new JButton("确定");
 117     //第八个窗口的按钮=======<查看金额>
 118     private JButton b5 = new JButton("返回");
 119     private JButton b5t = new JButton("上一条");
 120     private JButton b5s = new JButton("下一条");
 121     //-----------------------------------------------------------------[单选按钮和下拉选择框]
 122     //单选按钮
 123     private JRadioButton jr1 = new JRadioButton("是");
 124     private JRadioButton jr2 = new JRadioButton("否");
 125     //下拉选择框
 126     private Choice mainchoice = new Choice(); 
 127     private Choice fun3choice = new Choice();
 128     private Choice fun2choice = new Choice();
 129     //-----------------------------------------------------------------[各个界面窗口]
 130     //---[录入账号界面]
 131     protected JFrame FirstWin = new JFrame();
 132     //---[录入密码界面]
 133     protected JFrame SecondWin = new JFrame();
 134     //---[主窗口]
 135     protected JFrame MainWin = new JFrame();
 136     //---[存款窗口]
 137     //初始窗口
 138     protected JFrame fun1 = new JFrame();
 139     //确认窗口
 140     protected JFrame fun6 = new JFrame();
 141     //---[取款窗口]
 142     //初始窗口
 143     protected JFrame fun2 = new JFrame();
 144     //成功取款界面
 145     protected JFrame fun11 = new JFrame();
 146     //输入取款金额界面
 147     protected JFrame fun12 = new JFrame();
 148     //---[转账窗口]
 149     //初始窗口
 150     protected JFrame fun3 = new JFrame();
 151     //输入转账金额窗口
 152     protected JFrame fun7 = new JFrame();
 153     //转账确认窗口
 154     protected JFrame fun8 = new JFrame();
 155     //转账说明窗口
 156     protected JFrame fun9 = new JFrame();
 157     //---[修改密码]
 158     //输入密码窗口
 159     protected JFrame fun4 = new JFrame();
 160     //修改成功窗口
 161     protected JFrame fun10 = new JFrame();
 162     //---[显示窗口]
 163     protected JFrame fun5 = new JFrame();
 164     //---[错误报告窗口]
 165     //==小消息窗口
 166     private JFrame FirstWinor = new JFrame("#;错误信息");
 167     private JFrame SecondWinor = new JFrame("#;错误信息");
 168     private JFrame fun1Winor = new JFrame("#;错误信息");
 169     private JFrame fun2Winor = new JFrame("#;错误信息");
 170     private JFrame fun3Winor = new JFrame("#;错误信息");
 171     private JFrame fun4Winor = new JFrame("#;错误信息");
 172     //==消息内容
 173     private JLabel jl_for = new JLabel("该卡不是工行卡!");    
 174     private JLabel jl_for2 = new JLabel("密码录入错误");
 175     private JLabel jl_for3 = new JLabel("输入金额有误");
 176     private JLabel jl_for5 = new JLabel("转账金额有误");
 177     private JLabel jl_for6 = new JLabel("两次输入的密码不一致");
 178     private JLabel jl_for4 = new JLabel("账户余额不足"); 
 179     //-------------------<窗口实现函数>------------------------//
 180     //---[输入账户窗口实现及运行]
 181     public void Firstwin() throws FileNotFoundException{
 182         readfile();
 183         Resettimes();
 184         ResetButtons();
 185         CanSeeWin(true,false,false,false,false,false,false,false);
 186         if(times1==0)
 187         {
 188             times1 = 1;
 189             bfw.addActionListener//为转换按钮添加监听事件
 190             (
 191                     new ActionListener()
 192                     {
 193                         public void actionPerformed(ActionEvent arg0){
 194                         //弹出对话框
 195                             String e1 = jt1.getText();//输入的数据
 196                             int existfor = 5;//此处用于测试是否账号不存在
 197                             for(int i=0;i<5;i++)//检测数组中是否存有该数据!
 198                                 if(ku[i].GetaccountID().compareTo(e1)==0)
 199                                 {
 200                                     FirstWinor.setVisible(false);
 201                                     existfor = i;
 202                                     break;
 203                                 }
 204                             if(existfor==5)
 205                             {
 206                                 
 207                                 FirstWinor.setVisible(true);
 208                                 try {
 209                                     Firstwin();
 210                                 } catch (FileNotFoundException e) {
 211                                     // TODO 自动生成的 catch 块
 212                                     e.printStackTrace();
 213                                 }
 214                             } else
 215                                 pass = existfor;
 216                                 try {
 217                                     Secondwin();
 218                                 } catch (FileNotFoundException e) {
 219                                     // TODO 自动生成的 catch 块
 220                                     e.printStackTrace();
 221                                 }
 222                         }
 223                     }
 224             );   
 225         }
 226     }
 227     //---[输入密码窗口实现及运行]
 228     public void Secondwin() throws FileNotFoundException{
 229         times = 0;
 230         SecondWinor.setVisible(false);
 231         readfile();
 232         Win2();
 233         CanSeeWin(false,true,false,false,false,false,false,false);
 234         if(times2==0)
 235         {
 236             times2 = 1;
 237             bsw.addActionListener//为转换按钮添加监听事件
 238             (
 239                     new ActionListener()
 240                     {
 241                         public void actionPerformed(ActionEvent arg0){
 242                         //弹出对话框
 243                             String saving = jt2.getText();//输入的数据 
 244                             if(ku[pass].Getaccountpassword().compareTo(saving)!=0)
 245                             {
 246                                 SecondWinor.setVisible(true);
 247                             }
 248                             else
 249                             {
 250                                 SecondWinor.setVisible(false);
 251                             }
 252                             if(times==3&&ku[pass].Getaccountpassword().compareTo(saving)!=0)
 253                             {
 254                                 try {
 255                                     Firstwin();
 256                                 } catch (FileNotFoundException e) {
 257                                     // TODO 自动生成的 catch 块
 258                                     e.printStackTrace();
 259                                 }
 260                             }
 261                             else if(ku[pass].Getaccountpassword().compareTo(saving)==0)
 262                             {
 263                                 try {
 264                                     Mainwin();
 265                                 } catch (FileNotFoundException e) {
 266                                     // TODO 自动生成的 catch 块
 267                                     e.printStackTrace();
 268                                 }
 269                             }
 270                             else
 271                                 times++;
 272                         }
 273                         
 274                     }
 275             );
 276         }
 277     }
 278     //---[主窗口实现及运行]
 279     public void Mainwin() throws FileNotFoundException{
 280         readfile();
 281         Win3();
 282         fun9.setVisible(false);
 283         CanSeeWin(false,false,true,false,false,false,false,false);
 284         if(times3==0)
 285         {
 286             times = 1;
 287             bmw.addActionListener//为转换按钮添加监听事件
 288             (
 289                     new ActionListener()
 290                     {
 291                         public void actionPerformed(ActionEvent arg0){
 292                         //弹出对话框
 293                             String choice = mainchoice.getSelectedItem();
 294                             if(choice.compareTo(mainchoice.getItem(0))==0)
 295                             {
 296                                 ku[pass].Setoperatetype(1);
 297                                 try {
 298                                     writefile();
 299                                 } catch (IOException e1) {
 300                                     // TODO 自动生成的 catch 块
 301                                     e1.printStackTrace();
 302                                 }
 303                                 try {
 304                                     Fun1();
 305                                 } catch (FileNotFoundException e) {
 306                                     // TODO 自动生成的 catch 块
 307                                     e.printStackTrace();
 308                                 }
 309                             }
 310                             else if(choice.compareTo(mainchoice.getItem(1))==0)
 311                             {
 312                                 ku[pass].Setoperatetype(2);
 313                                 try {
 314                                     writefile();
 315                                 } catch (IOException e1) {
 316                                     // TODO 自动生成的 catch 块
 317                                     e1.printStackTrace();
 318                                 }
 319                                 try {
 320                                     Fun2();
 321                                 } catch (FileNotFoundException e) {
 322                                     // TODO 自动生成的 catch 块
 323                                     e.printStackTrace();
 324                                 }
 325                             }
 326                             else if(choice.compareTo(mainchoice.getItem(2))==0)
 327                             {
 328                                 ku[pass].Setoperatetype(3);
 329                                 try {
 330                                     writefile();
 331                                 } catch (IOException e1) {
 332                                     // TODO 自动生成的 catch 块
 333                                     e1.printStackTrace();
 334                                 }
 335                                 try {
 336                                     Fun3();
 337                                 } catch (FileNotFoundException e) {
 338                                     // TODO 自动生成的 catch 块
 339                                     e.printStackTrace();
 340                                 }
 341                             }
 342                             else if(choice.compareTo(mainchoice.getItem(3))==0)
 343                             {
 344                                 ku[pass].Setoperatetype(4);
 345                                 try {
 346                                     writefile();
 347                                 } catch (IOException e1) {
 348                                     // TODO 自动生成的 catch 块
 349                                     e1.printStackTrace();
 350                                 }
 351                                 try {
 352                                     Fun4();
 353                                 } catch (FileNotFoundException e) {
 354                                     // TODO 自动生成的 catch 块
 355                                     e.printStackTrace();
 356                                 }
 357                             }
 358                             else if(choice.compareTo(mainchoice.getItem(4))==0)
 359                             {
 360                                 ku[pass].Setoperatetype(5);
 361                                 try {
 362                                     writefile();
 363                                 } catch (IOException e1) {
 364                                     // TODO 自动生成的 catch 块
 365                                     e1.printStackTrace();
 366                                 }
 367                                 try {
 368                                     Fun5();
 369                                 } catch (FileNotFoundException e) {
 370                                     // TODO 自动生成的 catch 块
 371                                     e.printStackTrace();
 372                                 }
 373                             }
 374                             else if(choice.compareTo(mainchoice.getItem(5))==0)
 375                             {
 376                                 ku[pass].Setoperatetype(0);
 377                                 try {
 378                                     writefile();
 379                                 } catch (IOException e1) {
 380                                     // TODO 自动生成的 catch 块
 381                                     e1.printStackTrace();
 382                                 }
 383                                 try {
 384                                     Firstwin();
 385                                 } catch (FileNotFoundException e) {
 386                                     // TODO 自动生成的 catch 块
 387                                     e.printStackTrace();
 388                                 }
 389                             }
 390                         }
 391                         
 392                     }
 393             );
 394         }
 395     }
 396     //---[存款窗口实现及运行]
 397     public void Fun1() throws FileNotFoundException{
 398         readfile();
 399         Win4();
 400         CanSeeWin(false,false,false,true,false,false,false,false);
 401         if(times4==0)
 402         {
 403             times4 = 1;
 404             b1.addActionListener//为转换按钮添加监听事件
 405             (
 406                     new ActionListener()
 407                     {
 408                         public void actionPerformed(ActionEvent arg0){
 409                         //弹出对话框
 410                             String standup = jt3.getText();
 411                             if(standup.compareTo("q")==0)
 412                             {
 413                                 ku[pass].Setoperatetype(0);
 414                                 try {
 415                                     writefile();
 416                                 } catch (IOException e1) {
 417                                     // TODO 自动生成的 catch 块
 418                                     e1.printStackTrace();
 419                                 }
 420                                 try {
 421                                     Firstwin();
 422                                 } catch (FileNotFoundException e) {
 423                                     // TODO 自动生成的 catch 块
 424                                     e.printStackTrace();
 425                                 }
 426                             }
 427                             else
 428                             {
 429                                 int tubes = Integer.parseInt(standup);
 430                                 if(tubes<=0)
 431                                 {
 432                                     fun1Winor.setVisible(true);
 433                                     try {
 434                                         Fun1();
 435                                     } catch (FileNotFoundException e) {
 436                                         // TODO 自动生成的 catch 块
 437                                         e.printStackTrace();
 438                                     }
 439                                 }
 440                                 else
 441                                 {
 442                                     fun1Winor.setVisible(false);
 443                                     ku[pass].Setamount(ku[pass].Getamount()+tubes);
 444                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()+tubes);
 445                                     //----------------------------------------------------<以下为文件更新阶段
 446                                     Scanner scs = null;
 447                                     try {
 448                                         scs = new Scanner (new FileReader(List));
 449                                     } catch (FileNotFoundException e4) {
 450                                         // TODO 自动生成的 catch 块
 451                                         e4.printStackTrace();
 452                                     }
 453                                     PrintWriter pws = null;
 454                                     try {
 455                                         pws = new PrintWriter (new FileWriter("files/LinShi"));
 456                                     } catch (IOException e3) {
 457                                         // TODO 自动生成的 catch 块
 458                                         e3.printStackTrace();
 459                                     }
 460                                     while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
 461                                     {
 462                                         pws.println(scs.nextLine());
 463                                     }
 464                                     pws.println(scs.nextLine());
 465                                     pws.close();
 466                                     Scanner scp = null;
 467                                     try {
 468                                         scp = new Scanner (new FileReader("files/LinShi"));
 469                                     } catch (FileNotFoundException e2) {
 470                                         // TODO 自动生成的 catch 块
 471                                         e2.printStackTrace();
 472                                     }
 473                                     PrintWriter pw = null;
 474                                     try {
 475                                         pw = new PrintWriter (new FileWriter(List));
 476                                     } catch (IOException e2) {
 477                                         // TODO 自动生成的 catch 块
 478                                         e2.printStackTrace();
 479                                     }
 480                                     pw.print(ku[pass].GetaccountID());
 481                                     pw.print(" ");
 482                                     pw.print(Today);
 483                                     ku[pass].Setoperatedate(Today);
 484                                     pw.print(" ");
 485                                     pw.print("SaveMoney");
 486                                     pw.print(" ");
 487                                     pw.println(tubes);
 488                                     while(!scp.hasNext("ENDOFTHISFILE"))
 489                                     {
 490                                         pw.println(scp.nextLine());
 491                                     }
 492                                     pw.println(scp.nextLine());
 493                                     pw.close();
 494                                     try {
 495                                         writefile();
 496                                     } catch (IOException e1) {
 497                                         // TODO 自动生成的 catch 块
 498                                         e1.printStackTrace();
 499                                     }
 500                                     fun1.setVisible(false);
 501                                     Win4_s();
 502                                 }
 503                             }
 504                         }
 505                     }
 506             );
 507             b1s.addActionListener(
 508                     new ActionListener()
 509                     {
 510                         public void actionPerformed(ActionEvent arg0){
 511                             //弹出对话框
 512                             fun6.setVisible(false);
 513                             try {
 514                                 Mainwin();
 515                             } catch (FileNotFoundException e) {
 516                                 // TODO 自动生成的 catch 块
 517                                 e.printStackTrace();
 518                             }
 519                         }
 520                     }
 521             );
 522         }
 523     }
 524     //---[取款窗口实现及运行]
 525     public void Fun2() throws FileNotFoundException{
 526         readfile();
 527         Win8();
 528         CanSeeWin(false,false,false,false,true,false,false,false);
 529         if(times5==0)
 530         {
 531             times5 = 1;
 532             b2.addActionListener//为转换按钮添加监听事件
 533             (
 534                     new ActionListener()
 535                     {
 536                         public void actionPerformed(ActionEvent arg0){
 537                             String zz;
 538                             int truechoice = 0;
 539                             zz = fun2choice.getSelectedItem();
 540                             if(zz.compareTo(fun2choice.getItem(0))==0)
 541                             {
 542                                 truechoice = 100;
 543                                 if(ku[pass].Getaccountbalance()<100)
 544                                 {
 545                                     fun2Winor.setVisible(true);
 546                                 }
 547                                 else
 548                                 {
 549                                     fun2Winor.setVisible(false);
 550                                     ku[pass].Setamount(ku[pass].Getamount()+100);
 551                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-100);
 552                                     Win8s(100);
 553                                     fun2.setVisible(false);
 554                                     fun11.setVisible(true);
 555                                 }
 556                             }
 557                             else if(zz.compareTo(fun2choice.getItem(1))==0)
 558                             {
 559                                 truechoice = 500;
 560                                 if(ku[pass].Getaccountbalance()<500)
 561                                 {
 562                                     fun2Winor.setVisible(true);
 563                                 }
 564                                 else
 565                                 {
 566                                     fun2Winor.setVisible(false);
 567                                     ku[pass].Setamount(ku[pass].Getamount()+500);
 568                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-500);
 569                                     Win8s(500);
 570                                     fun2.setVisible(false);
 571                                     fun11.setVisible(true);
 572                                 }
 573                             }
 574                             else if(zz.compareTo(fun2choice.getItem(2))==0)
 575                             {
 576                                 truechoice = 1000;
 577                                 if(ku[pass].Getaccountbalance()<1000)
 578                                 {
 579                                     fun2Winor.setVisible(true);
 580                                 }
 581                                 else
 582                                 {
 583                                     fun2Winor.setVisible(false);
 584                                     ku[pass].Setamount(ku[pass].Getamount()+1000);
 585                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-1000);
 586                                     Win8s(1000);
 587                                     fun2.setVisible(false);
 588                                     fun11.setVisible(true);
 589                                 }
 590                             }
 591                             else if(zz.compareTo(fun2choice.getItem(3))==0)
 592                             {
 593                                 truechoice = 1500;
 594                                 if(ku[pass].Getaccountbalance()<1500)
 595                                 {
 596                                     fun2Winor.setVisible(true);
 597                                 }
 598                                 else
 599                                 {
 600                                     fun2Winor.setVisible(false);
 601                                     ku[pass].Setamount(ku[pass].Getamount()+1500);
 602                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-1500);
 603                                     Win8s(1500);
 604                                     fun2.setVisible(false);
 605                                     fun11.setVisible(true);
 606                                 }
 607                             }
 608                             else if(zz.compareTo(fun2choice.getItem(4))==0)
 609                             {
 610                                 truechoice = 2000;
 611                                 if(ku[pass].Getaccountbalance()<2000)
 612                                 {
 613                                     fun2Winor.setVisible(true);
 614                                 }
 615                                 else
 616                                 {
 617                                     fun2Winor.setVisible(false);
 618                                     ku[pass].Setamount(ku[pass].Getamount()+2000);
 619                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-2000);
 620                                     Win8s(2000);
 621                                     fun2.setVisible(false);
 622                                     fun11.setVisible(true);
 623                                 }
 624                             }
 625                             else if(zz.compareTo(fun2choice.getItem(5))==0)
 626                             {
 627                                 truechoice = 5000;
 628                                 if(ku[pass].Getaccountbalance()<5000)
 629                                 {
 630                                     fun2Winor.setVisible(true);
 631                                 }
 632                                 else
 633                                 {
 634                                     fun2Winor.setVisible(false);
 635                                     ku[pass].Setamount(ku[pass].Getamount()+5000);
 636                                     ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-5000);
 637                                     Win8s(5000);
 638                                     fun2.setVisible(false);
 639                                     fun11.setVisible(true);
 640                                 }
 641                             }
 642                             else if(zz.compareTo(fun2choice.getItem(6))==0)
 643                             {
 644                                 //任意金额
 645                                 fun2Winor.setVisible(false);
 646                                 fun2.setVisible(false);
 647                                 fun11.setVisible(false);
 648                                 fun12.setVisible(true);
 649                                 truechoice = 0;
 650                                 Win8t();
 651                             }
 652                             else if(zz.compareTo(fun2choice.getItem(7))==0)
 653                             {
 654                                 truechoice = 0;
 655                                 try {
 656                                     Firstwin();
 657                                 } catch (FileNotFoundException e) {
 658                                     // TODO 自动生成的 catch 块
 659                                     e.printStackTrace();
 660                                 }
 661                             }
 662                             else if(zz.compareTo(fun2choice.getItem(8))==0)
 663                             {
 664                                 truechoice = 0;
 665                                 try {
 666                                     Mainwin();
 667                                 } catch (FileNotFoundException e) {
 668                                     // TODO 自动生成的 catch 块
 669                                     e.printStackTrace();
 670                                 }
 671                             }
 672                             if(truechoice!=0)
 673                             {
 674                                 Scanner scs = null;
 675                                 try {
 676                                     scs = new Scanner (new FileReader(List));
 677                                 } catch (FileNotFoundException e1) {
 678                                     // TODO 自动生成的 catch 块
 679                                     e1.printStackTrace();
 680                                 }
 681                                 PrintWriter pws = null;
 682                                 try {
 683                                     pws = new PrintWriter (new FileWriter("files/LinShi"));
 684                                 } catch (IOException e1) {
 685                                     // TODO 自动生成的 catch 块
 686                                     e1.printStackTrace();
 687                                 }
 688                                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
 689                                 {
 690                                     pws.println(scs.nextLine());
 691                                 }
 692                                 pws.println(scs.nextLine());
 693                                 pws.close();
 694                                 Scanner scp = null;
 695                                 try {
 696                                     scp = new Scanner (new FileReader("files/LinShi"));
 697                                 } catch (FileNotFoundException e1) {
 698                                     // TODO 自动生成的 catch 块
 699                                     e1.printStackTrace();
 700                                 }
 701                                 PrintWriter pw = null;
 702                                 try {
 703                                     pw = new PrintWriter (new FileWriter(List));
 704                                 } catch (IOException e1) {
 705                                     // TODO 自动生成的 catch 块
 706                                     e1.printStackTrace();
 707                                 }
 708                                 pw.print(ku[pass].GetaccountID());
 709                                 pw.print(" ");
 710                                 pw.print(Today);
 711                                 ku[pass].Setoperatedate(Today);
 712                                 pw.print(" ");
 713                                 pw.print("GetMoney");
 714                                 pw.print(" ");
 715                                 pw.println(truechoice);
 716                                 while(!scp.hasNext("ENDOFTHISFILE"))
 717                                 {
 718                                     pw.println(scp.nextLine());
 719                                 }
 720                                 pw.println(scp.nextLine());
 721                                 pw.close();
 722                                 try {
 723                                     writefile();
 724                                 } catch (IOException e) {
 725                                     // TODO 自动生成的 catch 块
 726                                     e.printStackTrace();
 727                                 }
 728                             }
 729                         }
 730                     }
 731             );
 732             
 733             b2s.addActionListener
 734             (
 735                     new ActionListener(){
 736                         public void actionPerformed(ActionEvent arg0){
 737                             fun11.setVisible(false);
 738                             fun2.setVisible(false);
 739                             try {
 740                                 Mainwin();
 741                             } catch (FileNotFoundException e) {
 742                                 // TODO 自动生成的 catch 块
 743                                 e.printStackTrace();
 744                             }
 745                         }
 746                     }
 747             );
 748             b2t.addActionListener
 749             (
 750                     new ActionListener(){
 751                         public void actionPerformed(ActionEvent arg0){
 752                             String find;
 753                             find = jt4.getText();
 754                             int finds;
 755                             finds = Integer.parseInt(find);
 756                             if(find.compareTo("q")==0)
 757                             {
 758                                 fun12.setVisible(false);
 759                                 try {
 760                                     Mainwin();
 761                                 } catch (FileNotFoundException e) {
 762                                     // TODO 自动生成的 catch 块
 763                                     e.printStackTrace();
 764                                 }
 765                             }
 766                             else
 767                             {
 768                                 fun2.setVisible(false);
 769                                 fun12.setVisible(false);
 770                                 fun11.setVisible(true);
 771                                 Win8s(finds);
 772                                 Scanner scs = null;
 773                                 try {
 774                                     scs = new Scanner (new FileReader(List));
 775                                 } catch (FileNotFoundException e1) {
 776                                     // TODO 自动生成的 catch 块
 777                                     e1.printStackTrace();
 778                                 }
 779                                 PrintWriter pws = null;
 780                                 try {
 781                                     pws = new PrintWriter (new FileWriter("files/LinShi"));
 782                                 } catch (IOException e1) {
 783                                     // TODO 自动生成的 catch 块
 784                                     e1.printStackTrace();
 785                                 }
 786                                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
 787                                 {
 788                                     pws.println(scs.nextLine());
 789                                 }
 790                                 pws.println(scs.nextLine());
 791                                 pws.close();
 792                                 Scanner scp = null;
 793                                 try {
 794                                     scp = new Scanner (new FileReader("files/LinShi"));
 795                                 } catch (FileNotFoundException e1) {
 796                                     // TODO 自动生成的 catch 块
 797                                     e1.printStackTrace();
 798                                 }
 799                                 PrintWriter pw = null;
 800                                 try {
 801                                     pw = new PrintWriter (new FileWriter(List));
 802                                 } catch (IOException e1) {
 803                                     // TODO 自动生成的 catch 块
 804                                     e1.printStackTrace();
 805                                 }
 806                                 pw.print(ku[pass].GetaccountID());
 807                                 pw.print(" ");
 808                                 pw.print(Today);
 809                                 ku[pass].Setoperatedate(Today);
 810                                 pw.print(" ");
 811                                 pw.print("GetMoney");
 812                                 pw.print(" ");
 813                                 pw.println(finds);
 814                                 while(!scp.hasNext("ENDOFTHISFILE"))
 815                                 {
 816                                     pw.println(scp.nextLine());
 817                                 }
 818                                 pw.println(scp.nextLine());
 819                                 pw.close();
 820                                 try {
 821                                     writefile();
 822                                 } catch (IOException e) {
 823                                     // TODO 自动生成的 catch 块
 824                                     e.printStackTrace();
 825                                 }
 826                             }
 827                         }
 828                     }
 829             );
 830         }
 831     }
 832     //---[转账窗口实现及运行]
 833     public void Fun3() throws FileNotFoundException{
 834         readfile();
 835         temporay = -1;
 836         CanSeeWin(false,false,false,false,false,true,false,false);
 837         Win5();
 838         if(times6==0)
 839         {
 840             times6 = 1;
 841             b3.addActionListener//为转换按钮添加监听事件
 842             (
 843                     new ActionListener()
 844                     {
 845                         public void actionPerformed(ActionEvent arg0){
 846                         //弹出对话框
 847                             String gobob = fun3choice.getSelectedItem();
 848                             if(gobob.compareTo("Q:返回")==0)
 849                             {
 850                                 try {
 851                                     Mainwin();
 852                                 } catch (FileNotFoundException e) {
 853                                     // TODO 自动生成的 catch 块
 854                                     e.printStackTrace();
 855                                 }
 856                             }
 857                             else
 858                             {
 859                                 for(int i=0;i<5;i++)
 860                                     if(gobob.compareTo(ku[i].Getaccountname())==0)
 861                                     {
 862                                         fun3.setVisible(false);
 863                                         fun7.setVisible(true);
 864                                         temporay = i;
 865                                         Win5_s();
 866                                         break;
 867                                     }
 868                             }
 869                         }
 870                     }
 871             );
 872             b3s.addActionListener//为转换按钮添加监听事件
 873             (
 874                     new ActionListener()
 875                     {
 876                         public void actionPerformed(ActionEvent arg0){
 877                         //弹出对话框 
 878                             String standup = jt5.getText();
 879                             fun7.setVisible(false);
 880                             tubes = Integer.parseInt(standup);
 881                             if(tubes<=0)//钱数不对
 882                             {
 883                                 fun3Winor.setVisible(true);
 884                             }
 885                             else//继续执行
 886                             {
 887                                 if(tubes>ku[pass].Getaccountbalance())
 888                                 {
 889                                     fun3Winor.setVisible(true);
 890                                 }
 891                                 else
 892                                 {
 893                                     fun3Winor.setVisible(false);
 894                                     fun8.setVisible(true);
 895                                     Win5_t(tubes);
 896                                 }
 897                             }    
 898                         }
 899                     }
 900             );
 901             b3t.addActionListener
 902             (
 903                     new ActionListener()
 904                     {
 905                         public void actionPerformed(ActionEvent arg0){
 906                             if(ifyes)//转账
 907                             {
 908                                 ku[pass].Setaccountbalance(ku[pass].Getaccountbalance()-tubes);
 909                                 ku[pass].Setamount(ku[pass].Getamount()+tubes);
 910                                 ku[temporay].Setaccountbalance(ku[temporay].Getaccountbalance()+tubes);
 911                                 ku[temporay].Setamount(ku[temporay].Getamount()+tubes);
 912                                 //----------------------------------------------------<以下为文件更新阶段
 913                                 Scanner scs = null;
 914                                 try {
 915                                     scs = new Scanner (new FileReader(List));
 916                                 } catch (FileNotFoundException e1) {
 917                                     // TODO 自动生成的 catch 块
 918                                     e1.printStackTrace();
 919                                 }
 920                                 PrintWriter pws = null;
 921                                 try {
 922                                     pws = new PrintWriter (new FileWriter("files/LinShi"));
 923                                 } catch (IOException e1) {
 924                                     // TODO 自动生成的 catch 块
 925                                     e1.printStackTrace();
 926                                 }
 927                                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
 928                                 {
 929                                     pws.println(scs.nextLine());
 930                                 }
 931                                 pws.println(scs.nextLine());
 932                                 pws.close();
 933                                 Scanner scp = null;
 934                                 try {
 935                                     scp = new Scanner (new FileReader("files/LinShi"));
 936                                 } catch (FileNotFoundException e1) {
 937                                     // TODO 自动生成的 catch 块
 938                                     e1.printStackTrace();
 939                                 }
 940                                 PrintWriter pw = null;
 941                                 try {
 942                                     pw = new PrintWriter (new FileWriter(List));
 943                                 } catch (IOException e1) {
 944                                     // TODO 自动生成的 catch 块
 945                                     e1.printStackTrace();
 946                                 }
 947                                 pw.print(ku[pass].GetaccountID());
 948                                 pw.print(" ");
 949                                 pw.print(Today);
 950                                 ku[pass].Setoperatedate(Today);
 951                                 pw.print(" ");
 952                                 try {
 953                                     writefile();
 954                                 } catch (IOException e) {
 955                                     // TODO 自动生成的 catch 块
 956                                     e.printStackTrace();
 957                                 }
 958                                 pw.print("RemoveMoney");
 959                                 pw.print(" ");
 960                                 pw.println(tubes);
 961                                 while(!scp.hasNext("ENDOFTHISFILE"))
 962                                 {
 963                                     pw.println(scp.nextLine());
 964                                 }
 965                                 pw.println(scp.nextLine());
 966                                 pw.close();
 967                                 fun8.setVisible(false);
 968                                 fun9.setVisible(true);
 969                                 //-----------------------------------
 970                                 Win5_f(tubes,temporay);
 971                             }
 972                             else//不转
 973                             {
 974                                 fun8.setVisible(false);
 975                                 fun9.setVisible(false);
 976                                 try {
 977                                     Mainwin();
 978                                 } catch (FileNotFoundException e) {
 979                                     // TODO 自动生成的 catch 块
 980                                     e.printStackTrace();
 981                                 }
 982                             }
 983                         }
 984                     }
 985             );
 986             jr1.addActionListener(//
 987                     new ActionListener() {
 988 
 989                         public void actionPerformed(ActionEvent arg0) {
 990                             // TODO 自动生成的方法存根
 991                             ifyes = true;
 992                         }
 993                     }
 994             );
 995             jr2.addActionListener(//
 996                     new ActionListener() {
 997 
 998                         public void actionPerformed(ActionEvent arg0) {
 999                             // TODO 自动生成的方法存根
1000                             ifyes = false;
1001                         }
1002                     }
1003             );
1004             b3f.addActionListener
1005             (
1006                     new ActionListener()
1007                     {
1008                         public void actionPerformed(ActionEvent arg0){
1009                             try {
1010                                 Mainwin();
1011                             } catch (FileNotFoundException e) {
1012                                 // TODO 自动生成的 catch 块
1013                                 e.printStackTrace();
1014                             }
1015                         }            
1016                     }
1017             );
1018         }
1019     }
1020     //---[修改密码窗口实现及运行]
1021     public void Fun4() throws FileNotFoundException{
1022         readfile();
1023         Win6();
1024         CanSeeWin(false,false,false,false,false,false,true,false);
1025         if(times7==0)
1026         {
1027             times7 = 1;
1028             JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1029             JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1030             JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1031             JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1032             JLabel jl4 = new JLabel("                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ");
1033             JLabel jl5 = new JLabel("当前账户密码修改成功");
1034             JLabel jl6 = new JLabel("                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ");
1035             fun10.getContentPane().removeAll();
1036             fun10.setVisible(false);
1037             Container c10 = fun10.getContentPane();
1038             fun10.getContentPane().setLayout(new FlowLayout());
1039             ((JPanel)fun10.getContentPane()).setOpaque(false);
1040             JLabel background10 = new JLabel(Win);
1041             fun10.getLayeredPane().add(background10, new Integer(Integer.MIN_VALUE));
1042             background10.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1043             fun10.setTitle("中国工商银行自动柜员系统——存款窗口");
1044             fun10.setSize(600,400);
1045             fun10.setLocation(500,300);
1046             fun10.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1047             fun10.setResizable(false);
1048             fun10.getContentPane().setLayout(new FlowLayout());
1049             c10.add(jl0);
1050             c10.add(jl1);
1051             c10.add(jl2);
1052             c10.add(jl3);
1053             c10.add(jl4);
1054             c10.add(jl5);
1055             c10.add(jl6);
1056             c10.add(b4s);
1057             b4s.addActionListener
1058             (
1059                     new ActionListener()
1060                     {
1061                         public void actionPerformed(ActionEvent arg0){
1062                             fun10.setVisible(false);
1063                             try {
1064                                 Mainwin();
1065                             } catch (FileNotFoundException e) {
1066                                 // TODO 自动生成的 catch 块
1067                                 e.printStackTrace();
1068                             }
1069                         }            
1070                     }
1071             );
1072             b4.addActionListener//为转换按钮添加监听事件
1073             (
1074                     new ActionListener()
1075                     {
1076                         public void actionPerformed(ActionEvent arg0){
1077                         //弹出对话框
1078                             String str1,str2,str3;
1079                             str1 = jt7.getText();
1080                             str2 = jt7s.getText();
1081                             str3 = jt7t.getText();
1082                             if(ku[pass].Getaccountpassword().compareTo(str1)==0)
1083                             {
1084                                 SecondWinor.setVisible(false);
1085                                 if(str2.compareTo("q")==0||str3.compareTo("q")==0)
1086                                 {
1087                                     fun4Winor.setVisible(false);
1088                                     try {
1089                                         Mainwin();
1090                                     } catch (FileNotFoundException e) {
1091                                         // TODO 自动生成的 catch 块
1092                                         e.printStackTrace();
1093                                     }
1094                                 }
1095                                 else if(str2.compareTo(str3)==0)
1096                                 {
1097                                     fun4Winor.setVisible(false);
1098                                     ku[pass].Setaccountpassword(str2);
1099                                     try {
1100                                         writefile();
1101                                     } catch (IOException e4) {
1102                                         // TODO 自动生成的 catch 块
1103                                         e4.printStackTrace();
1104                                     }
1105                                     //----------------------------------------------------<以下为文件更新阶段
1106                                     Scanner scs = null;
1107                                     try {
1108                                         scs = new Scanner (new FileReader(List));
1109                                     } catch (FileNotFoundException e3) {
1110                                         // TODO 自动生成的 catch 块
1111                                         e3.printStackTrace();
1112                                     }
1113                                     PrintWriter pws = null;
1114                                     try {
1115                                         pws = new PrintWriter (new FileWriter("files/LinShi"));
1116                                     } catch (IOException e2) {
1117                                         // TODO 自动生成的 catch 块
1118                                         e2.printStackTrace();
1119                                     }
1120                                     while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
1121                                     {
1122                                         pws.println(scs.nextLine());
1123                                     }
1124                                     pws.println(scs.nextLine());
1125                                     pws.close();
1126                                     Scanner scp = null;
1127                                     try {
1128                                         scp = new Scanner (new FileReader("files/LinShi"));
1129                                     } catch (FileNotFoundException e1) {
1130                                         // TODO 自动生成的 catch 块
1131                                         e1.printStackTrace();
1132                                     }
1133                                     PrintWriter pw = null;
1134                                     try {
1135                                         pw = new PrintWriter (new FileWriter(List));
1136                                     } catch (IOException e1) {
1137                                         // TODO 自动生成的 catch 块
1138                                         e1.printStackTrace();
1139                                     }
1140                                     pw.print(ku[pass].GetaccountID());
1141                                     pw.print(" ");
1142                                     pw.print(Today);
1143                                     ku[pass].Setoperatedate(Today);
1144                                     pw.print(" ");
1145                                     try {
1146                                         writefile();
1147                                     } catch (IOException e) {
1148                                         // TODO 自动生成的 catch 块
1149                                         e.printStackTrace();
1150                                     }
1151                                     pw.print("ChangePassword");
1152                                     pw.print(" ");
1153                                     pw.println("**********");
1154                                     while(!scp.hasNext("ENDOFTHISFILE"))
1155                                     {
1156                                         pw.println(scp.nextLine());
1157                                     }
1158                                     pw.println(scp.nextLine());
1159                                     pw.close();
1160                                     fun10.setVisible(true);
1161                                 }
1162                                 else
1163                                 {
1164                                     fun4Winor.setVisible(true);
1165                                 }
1166                             }
1167                             else if(str1.compareTo("q")==0)
1168                             {
1169                                 SecondWinor.setVisible(false);
1170                                 try {
1171                                     Mainwin();
1172                                 } catch (FileNotFoundException e) {
1173                                     // TODO 自动生成的 catch 块
1174                                     e.printStackTrace();
1175                                 }
1176                             }
1177                             else
1178                             {
1179                                 SecondWinor.setVisible(true);
1180                             }
1181                         }
1182                     }
1183             );
1184         }
1185     }
1186     //---[查询数据窗口实现及运行]
1187     public void Fun5() throws FileNotFoundException{
1188         readfile();
1189         CanSeeWin(false,false,false,false,false,false,false,true);
1190         Win7();
1191         int sx = 1;
1192         TextOfThis = 1;
1193         setJt6();
1194         Scanner sl = new Scanner (new File(List));
1195         while(true)
1196         {
1197             String str3 = sl.next();//账户
1198             if(str3.compareTo("ENDOFTHISFILE")==0)
1199                 break;
1200             String str1 = sl.next();//日期
1201             String str2 = sl.next();//操作类型
1202             String dateofthis = sl.next();//操作金额
1203             if(ku[pass].GetaccountID().compareTo(str3)==0)
1204             {
1205                 if(sx==1)
1206                     jt6.setText(sx+"、"+str1+"  "+str2+"   "+dateofthis);
1207                 sx++;
1208             }
1209         }
1210         if(times8==0)
1211         {
1212             times8 = 1;
1213             //返回
1214             b5.addActionListener
1215             (
1216                     new ActionListener()
1217                     {
1218                         public void actionPerformed(ActionEvent arg0){
1219                             try {
1220                                 Mainwin();
1221                             } catch (FileNotFoundException e) {
1222                                 // TODO 自动生成的 catch 块
1223                                 e.printStackTrace();
1224                             }
1225                         }
1226                     }
1227             );
1228             //下一条
1229             b5s.addActionListener
1230             (
1231                     new ActionListener()
1232                     {
1233                         public void actionPerformed(ActionEvent arg0){
1234                             try {
1235                                 if(TextOfThis==Length()-1)
1236                                 {
1237                                     TextOfThis++;
1238                                     b5s.setEnabled(false);
1239                                 }
1240                                 else
1241                                 {
1242                                     TextOfThis++;
1243                                     b5s.setEnabled(true);
1244                                 }
1245                                 b5t.setEnabled(true);
1246                                 setJt6();
1247                             } catch (FileNotFoundException e) {
1248                                 // TODO 自动生成的 catch 块
1249                                 e.printStackTrace();
1250                             }
1251                         }
1252                     }
1253             );
1254             //上一条
1255             b5t.addActionListener
1256             (
1257                     new ActionListener()
1258                     {
1259                         public void actionPerformed(ActionEvent arg0){
1260                             try {
1261                                 if(TextOfThis==2)
1262                                 {
1263                                     TextOfThis--;
1264                                     b5t.setEnabled(false);
1265                                 }
1266                                 else
1267                                 {
1268                                     TextOfThis--;
1269                                     b5t.setEnabled(true);
1270                                 }
1271                                 b5s.setEnabled(true);
1272                                 setJt6();
1273                             } catch (FileNotFoundException e) {
1274                                 // TODO 自动生成的 catch 块
1275                                 e.printStackTrace();
1276                             }
1277                         }
1278                     }
1279             );
1280         }
1281     }
1282     //---------------------<内部函数>-------------------------//
1283     //可视化处理
1284     private void CanSeeWin(boolean fw,boolean sw,boolean mw,boolean f1,boolean f2,boolean f3,boolean f4,boolean f5){
1285         //-------------------------------------------------------------------//
1286         ((JPanel)FirstWin.getContentPane()).setOpaque(false);
1287         JLabel background = new JLabel(Win);
1288         FirstWin.getLayeredPane().add(background, new Integer(Integer.MIN_VALUE));
1289         background.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1290         //-------------------------------------------------------------------//
1291         ((JPanel)SecondWin.getContentPane()).setOpaque(false);
1292         JLabel backgrounds = new JLabel(Win);
1293         SecondWin.getLayeredPane().add(backgrounds, new Integer(Integer.MIN_VALUE));
1294         backgrounds.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1295         //-------------------------------------------------------------------//
1296         ((JPanel)MainWin.getContentPane()).setOpaque(false);
1297         JLabel backgroundr = new JLabel(Win);
1298         MainWin.getLayeredPane().add(backgroundr, new Integer(Integer.MIN_VALUE));
1299         backgroundr.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1300         //-------------------------------------------------------------------//
1301         ((JPanel)fun1.getContentPane()).setOpaque(false);
1302         JLabel background1 = new JLabel(Win);
1303         fun1.getLayeredPane().add(background1, new Integer(Integer.MIN_VALUE));
1304         background1.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1305         //-------------------------------------------------------------------//
1306         ((JPanel)fun2.getContentPane()).setOpaque(false);
1307         JLabel background2 = new JLabel(Win);
1308         fun2.getLayeredPane().add(background2, new Integer(Integer.MIN_VALUE));
1309         background2.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1310         //-------------------------------------------------------------------//
1311         ((JPanel)fun3.getContentPane()).setOpaque(false);
1312         JLabel background3 = new JLabel(Win);
1313         fun3.getLayeredPane().add(background3, new Integer(Integer.MIN_VALUE));
1314         background3.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1315         //-------------------------------------------------------------------//
1316         ((JPanel)fun4.getContentPane()).setOpaque(false);
1317         JLabel background4 = new JLabel(Win);
1318         fun4.getLayeredPane().add(background4, new Integer(Integer.MIN_VALUE));
1319         background4.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1320         //-------------------------------------------------------------------//
1321         ((JPanel)fun5.getContentPane()).setOpaque(false);
1322         JLabel background5 = new JLabel(Win);
1323         fun5.getLayeredPane().add(background5, new Integer(Integer.MIN_VALUE));
1324         background5.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1325         //-------------------------------------------------------------------//
1326         //---[窗口可视]
1327         FirstWin.setVisible(fw);
1328         SecondWin.setVisible(sw);
1329         MainWin.setVisible(mw);
1330         fun1.setVisible(f1);
1331         fun2.setVisible(f2);
1332         fun3.setVisible(f3);
1333         fun4.setVisible(f4);
1334         fun5.setVisible(f5);
1335     }
1336     //构造函数
1337     public Test100() throws FileNotFoundException{
1338         //------------------------------------------------------//硬性设置
1339         //处理前不显示
1340         CanSeeWin(false,false,false,false,false,false,false,false);
1341         //保证数组可用——分配空间存储
1342         for(int i=0;i<5;i++)
1343             ku[i] = new Account();
1344         //读取文件数据
1345         readfile();
1346         //设置日期
1347         ResetDate();
1348         //------------------------------------------------------//按钮等插件设置
1349         //设置按钮显示边界
1350         bfw.setBorderPainted(true);
1351         bsw.setBorderPainted(true);
1352         bmw.setBorderPainted(true);
1353         b1.setBorderPainted(true);
1354         b2.setBorderPainted(true);
1355         b2s.setBorderPainted(true);
1356         b2t.setBorderPainted(true);
1357         b3.setBorderPainted(true);
1358         b4.setBorderPainted(true);
1359         b4s.setBorderPainted(true);
1360         b5.setBorderPainted(true);
1361         b5s.setBorderPainted(true);
1362         b5t.setBorderPainted(true);
1363         //设置错误窗口
1364         FirstWinor.setSize(30,100);
1365         FirstWinor.add(jl_for);
1366         FirstWinor.setVisible(false);
1367         FirstWinor.setLocation(1200, 600);
1368         FirstWinor.setResizable(false);
1369         SecondWinor.setSize(30,100);
1370         SecondWinor.add(jl_for2);
1371         SecondWinor.setVisible(false);
1372         SecondWinor.setLocation(1200, 600);
1373         SecondWinor.setResizable(false);
1374         fun1Winor.setSize(30,100);
1375         fun1Winor.add(jl_for3);
1376         fun1Winor.setVisible(false);
1377         fun1Winor.setLocation(1200, 600);
1378         fun1Winor.setResizable(false);
1379         fun2Winor.setSize(30,100);
1380         fun2Winor.add(jl_for4);
1381         fun2Winor.setVisible(false);
1382         fun2Winor.setLocation(1200, 600);
1383         fun2Winor.setResizable(false);
1384         fun3Winor.setSize(30,100);
1385         fun3Winor.add(jl_for5);
1386         fun3Winor.setVisible(false);
1387         fun3Winor.setLocation(1200, 600);
1388         fun3Winor.setResizable(false);
1389         fun4Winor.setSize(30,100);
1390         fun4Winor.add(jl_for6);
1391         fun4Winor.setVisible(false);
1392         fun4Winor.setLocation(1200, 600);
1393         fun4Winor.setResizable(false);
1394         //下拉选择框
1395         mainchoice.setSize(50,20);
1396         mainchoice.add("1、存款");
1397         mainchoice.add("2、取款");
1398         mainchoice.add("3、转账汇款");
1399         mainchoice.add("4、修改密码");
1400         mainchoice.add("5、查询金额");
1401         mainchoice.add("Q、返回登陆账户界面");
1402         fun2choice.add("1、100元");
1403         fun2choice.add("2、500元");
1404         fun2choice.add("3、1000元");
1405         fun2choice.add("4、1500元");
1406         fun2choice.add("5、2000元");
1407         fun2choice.add("6、5000元;");
1408         fun2choice.add("7、其他金额");
1409         fun2choice.add("8、退卡");
1410         fun2choice.add("9、返回");
1411         //长度
1412         jt6.setEditable(false);
1413         jt6.setVisible(true);
1414         //------------------------------------------------------//启动
1415         //第一个窗口的设置
1416         Win1();
1417         //默认初始设置调入第一个窗口
1418         Firstwin();
1419     }
1420     //窗口1的设置
1421     //----------------------<窗口的制作>-------------------------//
1422     //输入账号
1423     private void Win1(){
1424         FirstWin.setTitle("中国工商银行自动柜员系统——输入账号窗口");
1425         FirstWin.setSize(600,400);
1426         FirstWin.setLocation(500,300);
1427         FirstWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1428         FirstWin.setResizable(false);
1429         //FirstWin.remove(bfw);
1430         Container cfw = FirstWin.getContentPane();
1431         FirstWin.getContentPane().setLayout(new FlowLayout());
1432         final JLabel jl0 =new JLabel("                                                                                                                                                                                                          ");
1433         final JLabel jl1 =new JLabel("                  ***************************************************************                    ");
1434         final JLabel jl2 =new JLabel("                                                        欢迎使用中国工商银行自动柜员系统                                                             ");
1435         final JLabel jl3 =new JLabel("                  ***************************************************************                    ");
1436         final JLabel jl4 =new JLabel("                                                                                                                                                                                                          ");
1437         final JLabel jl5 =new JLabel("                                                    请输入您的账号:                                                   ");
1438         final JLabel jl6 =new JLabel("                                                                                                                                                                                                    ");
1439         final JLabel jl7 =new JLabel("                                                                                                                                                                                                    ");
1440         cfw.add(jl0);
1441         cfw.add(jl1);
1442         cfw.add(jl2);
1443         cfw.add(jl3);
1444         cfw.add(jl4);
1445         cfw.add(jl5);
1446         cfw.add(jl6);
1447         cfw.add(jt1);
1448         cfw.add(jl7);
1449         cfw.add(bfw);
1450     }
1451     //窗口2的设置
1452     //输入密码
1453     private void Win2(){
1454         SecondWin.getContentPane().removeAll();
1455         ((JPanel)SecondWin.getContentPane()).setOpaque(false);
1456         JLabel backgrounds = new JLabel(Win);
1457         SecondWin.getLayeredPane().add(backgrounds, new Integer(Integer.MIN_VALUE));
1458         backgrounds.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1459         SecondWin.setTitle("中国工商银行自动柜员系统——输入密码窗口");
1460         SecondWin.setSize(600,400);
1461         SecondWin.setLocation(500,300);
1462         SecondWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1463         SecondWin.setResizable(false);
1464         Container csw = SecondWin.getContentPane();
1465         SecondWin.getContentPane().setLayout(new FlowLayout());//账号:20170002
1466         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1467         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1468         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1469         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1470         JLabel jl4 =new JLabel("                                                                                 请输入您的密码:                                                                              ");
1471         //jt2
1472         JLabel jl5 =new JLabel("                                                                                                                                                                                                       ");
1473         JLabel jl6 =new JLabel("                                                                                                                                                                                                       ");
1474         JLabel jl7 =new JLabel("                                                                                                                                                                                                       ");
1475         //bsw
1476         csw.add(jl0);
1477         csw.add(jl1);
1478         csw.add(jl2);
1479         csw.add(jl3);
1480         csw.add(jl6);
1481         csw.add(jl4);
1482         csw.add(jl7);
1483         csw.add(jt2);
1484         csw.add(jl5);
1485         csw.add(bsw);
1486     }
1487     //主窗口的设置
1488     //主窗口
1489     private void Win3(){
1490         MainWin.getContentPane().removeAll();
1491         ((JPanel)MainWin.getContentPane()).setOpaque(false);
1492         JLabel backgroundr = new JLabel(Win);
1493         MainWin.getLayeredPane().add(backgroundr, new Integer(Integer.MIN_VALUE));
1494         backgroundr.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1495         MainWin.setTitle("中国工商银行自动柜员系统——主窗口");
1496         MainWin.setSize(600,400);
1497         MainWin.setLocation(500,300);
1498         MainWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1499         MainWin.setResizable(false);
1500         Container cmw = MainWin.getContentPane();
1501         MainWin.getContentPane().setLayout(new FlowLayout());
1502         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1503         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1504         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1505         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1506         JLabel jl4 =new JLabel("                                                                             1、存款;                                                                             ");
1507         JLabel jl5 =new JLabel("                                                                             2、取款;                                                                             ");
1508         JLabel jl6 =new JLabel("                                                                             3、转账汇款;                                                                      ");
1509         JLabel jl7 =new JLabel("                                                                             4、修改密码;                                                                      ");
1510         JLabel jl8 =new JLabel("                                                                             5、查询金额;                                                                      ");
1511         JLabel jl10 = new JLabel("                                 ***************************************************************                              ");
1512         JLabel jl9 =new JLabel("                                                                               请输入:                                                                          ");
1513         JLabel jl12 = new JLabel("                                                                                                                                                                                                                                                             ");
1514         cmw.add(jl0);
1515         cmw.add(jl1);
1516         cmw.add(jl2);
1517         cmw.add(jl3);
1518         cmw.add(jl4);
1519         cmw.add(jl5);
1520         cmw.add(jl6);
1521         cmw.add(jl7);
1522         cmw.add(jl8);
1523         cmw.add(jl10);
1524         cmw.add(jl9);
1525         cmw.add(mainchoice);
1526         cmw.add(jl12);
1527         cmw.add(bmw);
1528     }
1529     //存款窗口
1530     //存款主窗口
1531     private void Win4(){
1532         fun1.getContentPane().removeAll();
1533         Container c1 = fun1.getContentPane();
1534         fun1.getContentPane().setLayout(new FlowLayout());
1535         ((JPanel)fun1.getContentPane()).setOpaque(false);
1536         JLabel background1 = new JLabel(Win);
1537         fun1.getLayeredPane().add(background1, new Integer(Integer.MIN_VALUE));
1538         background1.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1539         fun1.setTitle("中国工商银行自动柜员系统——存款窗口");
1540         fun1.setSize(600,400);
1541         fun1.setLocation(500,300);
1542         fun1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1543         fun1.setResizable(false);
1544         fun1.getContentPane().setLayout(new FlowLayout());
1545         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1546         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1547         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1548         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1549         JLabel jl4 = new JLabel("                                                     请输入存款金额;                                                    ");
1550         JLabel jl5 = new JLabel("                                                                                                                                                                                                                                ");
1551         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                ");
1552         JLabel jl7 = new JLabel("                                                                                                                                                                                                                                ");
1553         c1.add(jl0);
1554         c1.add(jl1);
1555         c1.add(jl2);
1556         c1.add(jl3);
1557         c1.add(jl6);
1558         c1.add(jl4);
1559         c1.add(jl5);
1560         c1.add(jt3);
1561         c1.add(jl7);
1562         c1.add(b1);
1563     }
1564     private void Win4_s(){
1565         fun6.getContentPane().removeAll();
1566         fun6.setVisible(true);
1567         Container c6 = fun6.getContentPane();
1568         fun6.getContentPane().setLayout(new FlowLayout());
1569         ((JPanel)fun6.getContentPane()).setOpaque(false);
1570         JLabel background6 = new JLabel(Win);
1571         fun6.getLayeredPane().add(background6, new Integer(Integer.MIN_VALUE));
1572         background6.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1573         fun6.setTitle("中国工商银行自动柜员系统——存款窗口");
1574         fun6.setSize(600,400);
1575         fun6.setLocation(500,300);
1576         fun6.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1577         fun6.setResizable(false);
1578         fun6.getContentPane().setLayout(new FlowLayout());
1579         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1580         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1581         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1582         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1583         JLabel jl4 = new JLabel("                                                        当前账户存款操作成功。                                                ");
1584         JLabel jl5 = new JLabel("                                                                                                                                                                              ");
1585         JLabel jl6 = new JLabel("                                             当前账户余额为:"+ku[pass].Getaccountbalance()+"元                                  ");
1586         JLabel jl7 = new JLabel("                                                                                                                                                                                                                                             ");
1587         c6.add(jl0);
1588         c6.add(jl1);
1589         c6.add(jl2);
1590         c6.add(jl3);
1591         c6.add(jl4);
1592         c6.add(jl5);
1593         c6.add(jl6);
1594         c6.add(jl7);
1595         c6.add(b1s);
1596     }
1597     //---------------------取款窗口
1598     //取款主窗口
1599     private void Win8(){
1600         fun2.getContentPane().removeAll();
1601         ((JPanel)fun2.getContentPane()).setOpaque(false);
1602         JLabel background3 = new JLabel(Win);
1603         fun2.getLayeredPane().add(background3, new Integer(Integer.MIN_VALUE));
1604         background3.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1605         Container c2 = fun2.getContentPane();
1606         fun2.getContentPane().setLayout(new FlowLayout());
1607         fun2.setTitle("中国工商银行自动柜员系统——取款窗口");
1608         fun2.setSize(600,400);
1609         fun2.setLocation(500,300);
1610         fun2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1611         fun2.setResizable(false);
1612         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1613         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1614         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1615         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1616         JLabel jl6 = new JLabel("                                                                                                                                                                              ");
1617         JLabel jl7 = new JLabel("                                  请选择                                 ");
1618         JLabel jl4 = new JLabel("                                                                                                                                                                                       ");
1619         JLabel jl5 = new JLabel("                                                                                                                                                                                                                                                                       ");
1620         c2.add(jl0);
1621         c2.add(jl1);
1622         c2.add(jl2);
1623         c2.add(jl3);
1624         c2.add(jl6);
1625         c2.add(jl7);
1626         c2.add(jl4);
1627         c2.add(fun2choice);
1628         c2.add(jl5);
1629         c2.add(b2);
1630     }
1631     private void Win8s(int num){
1632         fun11.getContentPane().removeAll();
1633         ((JPanel)fun11.getContentPane()).setOpaque(false);
1634         JLabel background11 = new JLabel(Win);
1635         fun11.getLayeredPane().add(background11, new Integer(Integer.MIN_VALUE));
1636         background11.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1637         Container c11 = fun11.getContentPane();
1638         fun11.getContentPane().setLayout(new FlowLayout());
1639         fun11.setTitle("中国工商银行自动柜员系统——取款窗口");
1640         fun11.setSize(600,400);
1641         fun11.setLocation(500,300);
1642         fun11.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1643         fun11.setResizable(false);
1644         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1645         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1646         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1647         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1648         JLabel jl6 = new JLabel("                                                                                                                                                                              ");
1649         JLabel jl7 = new JLabel("                                               当前账户取款操作"+num+"元成功。                                     ");
1650         JLabel jl4 = new JLabel("                                                                                                                             当前账户余额为:"+ku[pass].Getaccountbalance()+"元                                                                                                                              ");
1651         JLabel jl5 = new JLabel("                                                                                                                                                                                                                                                                       ");
1652         c11.add(jl0);
1653         c11.add(jl1);
1654         c11.add(jl2);
1655         c11.add(jl3);
1656         c11.add(jl6);
1657         c11.add(jl7);
1658         c11.add(jl4);
1659         c11.add(jl5);
1660         c11.add(b2s);
1661     }
1662     private void Win8t(){
1663         fun12.getContentPane().removeAll();
1664         ((JPanel)fun12.getContentPane()).setOpaque(false);
1665         JLabel background12 = new JLabel(Win);
1666         fun12.getLayeredPane().add(background12, new Integer(Integer.MIN_VALUE));
1667         background12.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());
1668         Container c12 = fun12.getContentPane();
1669         fun12.getContentPane().setLayout(new FlowLayout());
1670         fun12.setTitle("中国工商银行自动柜员系统——取款窗口");
1671         fun12.setSize(600,400);
1672         fun12.setLocation(500,300);
1673         fun12.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1674         fun12.setResizable(false);
1675         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1676         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1677         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1678         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1679         JLabel jl6 = new JLabel("                                                                                                                                                                              ");
1680         JLabel jl7 = new JLabel("                                               请输入取款金额:                                     ");
1681         JLabel jl4 = new JLabel("                                                                                                                             当前账户余额为:"+ku[pass].Getaccountbalance()+"元                                                                                                                              ");
1682         JLabel jl5 = new JLabel("                                                                                                                                                                                                                                                                       ");
1683         c12.add(jl0);
1684         c12.add(jl1);
1685         c12.add(jl2);
1686         c12.add(jl3);
1687         c12.add(jl6);
1688         c12.add(jl7);
1689         c12.add(jl4);
1690         c12.add(jt4);
1691         c12.add(jl5);
1692         c12.add(b2t);
1693     }
1694     //---------------------转账汇款窗口
1695     //转账账户选择
1696     //转账主窗口
1697     private void Win5(){
1698         fun3.getContentPane().removeAll();
1699         Container c3 = fun3.getContentPane();
1700         fun3.getContentPane().setLayout(new FlowLayout());
1701         ((JPanel)fun3.getContentPane()).setOpaque(false);
1702         JLabel background3 = new JLabel(Win);
1703         fun3.getLayeredPane().add(background3, new Integer(Integer.MIN_VALUE));
1704         background3.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1705         fun3.setTitle("中国工商银行自动柜员系统——转账窗口");
1706         fun3.setSize(600,400);
1707         fun3.setLocation(500,300);
1708         fun3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1709         fun3.setResizable(false);
1710         fun3.getContentPane().setLayout(new FlowLayout());
1711         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1712         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1713         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1714         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1715         JLabel jl4 = new JLabel("                                                     请输入转账账户;                                                    ");
1716         JLabel jl5 = new JLabel("                                                                                                                                                                              ");
1717         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                              ");
1718         c3.add(jl0);
1719         c3.add(jl1);
1720         c3.add(jl2);
1721         c3.add(jl3);
1722         c3.add(jl4);
1723         c3.add(jl5);
1724         fun3choice.removeAll();
1725         for(int i=0;i<5;i++)
1726             if(i!=pass)
1727                 fun3choice.add(ku[i].Getaccountname());
1728         fun3choice.add("Q:返回");
1729         c3.add(fun3choice);
1730         c3.add(jl6);
1731         c3.add(b3);
1732     }
1733     //转账金额选择
1734     //------------------------转账输入金额
1735     //转账金额输入
1736     private void Win5_s(){
1737         fun7.getContentPane().removeAll();
1738         Container c7 = fun7.getContentPane();
1739         fun7.getContentPane().setLayout(new FlowLayout());
1740         ((JPanel)fun7.getContentPane()).setOpaque(false);
1741         JLabel background7 = new JLabel(Win);
1742         fun7.getLayeredPane().add(background7, new Integer(Integer.MIN_VALUE));
1743         background7.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1744         fun7.setTitle("中国工商银行自动柜员系统——转账窗口");
1745         fun7.setSize(600,400);
1746         fun7.setLocation(500,300);
1747         fun7.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1748         fun7.setResizable(false);
1749         fun7.getContentPane().setLayout(new FlowLayout());
1750         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1751         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1752         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1753         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1754         JLabel jl4 = new JLabel("                                                     请输入转账金额;                                                    ");
1755         JLabel jl5 = new JLabel("                                                                                                                                                                              ");
1756         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                              ");
1757         c7.add(jl0);
1758         c7.add(jl1);
1759         c7.add(jl2);
1760         c7.add(jl3);
1761         c7.add(jl4);
1762         c7.add(jl5);
1763         c7.add(jt5);
1764         c7.add(jl6);
1765         c7.add(b3s);
1766     }
1767     //转账确认
1768     //转账确认
1769     private void Win5_t(int JinE){
1770         fun8.getContentPane().removeAll();
1771         Container c8 = fun8.getContentPane();
1772         fun8.getContentPane().setLayout(new FlowLayout());
1773         ((JPanel)fun8.getContentPane()).setOpaque(false);
1774         JLabel background8 = new JLabel(Win);
1775         fun8.getLayeredPane().add(background8, new Integer(Integer.MIN_VALUE));
1776         background8.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1777         fun8.setTitle("中国工商银行自动柜员系统——转账窗口");
1778         fun8.setSize(600,400);
1779         fun8.setLocation(500,300);
1780         fun8.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1781         fun8.setResizable(false);
1782         fun8.getContentPane().setLayout(new FlowLayout());
1783         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1784         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1785         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1786         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1787         JLabel jl4 = new JLabel("                                                     请确认是否向*"+ku[temporay].Getaccountname()+"转账"+JinE+"元。                                                    ");
1788         JLabel jl5 = new JLabel("                                                                                                                                                                                                       ");
1789         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                              ");
1790         c8.add(jl0);
1791         c8.add(jl1);
1792         c8.add(jl2);
1793         c8.add(jl3);
1794         c8.add(jl4);
1795         c8.add(jl5);
1796         ButtonGroup group = new ButtonGroup();//没有这句,你的单选按钮就不叫单选按钮,可以自己去掉试试
1797         group.add(jr1);
1798         group.add(jr2);
1799         c8.add(jr1);
1800         c8.add(jr2);
1801         c8.add(jl6);
1802         c8.add(b3t);
1803     }
1804     //------------------最后
1805     //转账内容显示
1806     //转账说明窗口
1807     private void Win5_f(int JinE,int pass_to){
1808         fun9.getContentPane().removeAll();
1809         Container c9 = fun9.getContentPane();
1810         fun9.getContentPane().setLayout(new FlowLayout());
1811         ((JPanel)fun9.getContentPane()).setOpaque(false);
1812         JLabel background9 = new JLabel(Win);
1813         fun9.getLayeredPane().add(background9, new Integer(Integer.MIN_VALUE));
1814         background9.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1815         fun9.setTitle("中国工商银行自动柜员系统——转账窗口");
1816         fun9.setSize(600,400);
1817         fun9.setLocation(500,300);
1818         fun9.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1819         fun9.setResizable(false);
1820         fun9.getContentPane().setLayout(new FlowLayout());
1821         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1822         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1823         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1824         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1825         JLabel jl4 = new JLabel("                                                     当前账户向*"+ku[temporay].Getaccountname()+"转账"+tubes+"元。                                                    ");
1826         JLabel jl5 = new JLabel("                                                                                                                                                                              ");
1827         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                              ");
1828         JLabel jl7 = new JLabel("                                                     当前账户余额为:"+ku[pass].Getaccountbalance()+"元                                                    ");
1829         c9.add(jl0);
1830         c9.add(jl1);
1831         c9.add(jl2);
1832         c9.add(jl3);
1833         c9.add(jl4);
1834         c9.add(jl5);
1835         c9.add(jl7);
1836         c9.add(jl6);
1837         c9.add(b3f);
1838     }
1839     //修改密码窗口
1840     //---------------------修改密码窗口
1841     //修改密码主窗口
1842     private void Win6(){
1843         fun4.getContentPane().removeAll();
1844         Container c4 = fun4.getContentPane();
1845         fun4.getContentPane().setLayout(new FlowLayout());
1846         ((JPanel)fun4.getContentPane()).setOpaque(false);
1847         JLabel background4 = new JLabel(Win);
1848         fun4.getLayeredPane().add(background4, new Integer(Integer.MIN_VALUE));
1849         background4.setBounds(0, 0, Win.getIconWidth(), Win.getIconHeight());    
1850         fun4.setTitle("中国工商银行自动柜员系统——修改密码窗口");
1851         fun4.setSize(600,400);
1852         fun4.setLocation(500,300);
1853         fun4.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1854         fun4.setResizable(false);
1855         fun4.getContentPane().setLayout(new FlowLayout());
1856         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1857         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1858         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1859         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1860         JLabel jl4 = new JLabel("                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ");
1861         JLabel jl5 = new JLabel("                        请输入当前密码:");
1862         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ");
1863         JLabel jl7 = new JLabel("                        请输入修改密码:");
1864         JLabel jl8 = new JLabel("                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ");
1865         JLabel jl9 = new JLabel("                        请输入确认密码:");
1866         JLabel jl10 = new JLabel("                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ");
1867         c4.add(jl0);
1868         c4.add(jl1);
1869         c4.add(jl2);
1870         c4.add(jl3);
1871         c4.add(jl4);
1872         c4.add(jl5);
1873         c4.add(jt7);
1874         c4.add(jl6);
1875         c4.add(jl7);
1876         c4.add(jt7s);
1877         c4.add(jl8);
1878         c4.add(jl9);
1879         c4.add(jt7t);
1880         c4.add(jl10);
1881         c4.add(b4);
1882     }
1883     //查询金额窗口
1884     //---------------------显示金额窗口
1885     //查询金额主窗口
1886     private void Win7() throws FileNotFoundException{
1887         fun5.getContentPane().removeAll();
1888         Container c5 = fun5.getContentPane();
1889         fun5.getContentPane().setLayout(new FlowLayout());
1890         fun5.setTitle("中国工商银行自动柜员系统——查询数据窗口");
1891         fun5.setSize(600,400);
1892         fun5.setLocation(500,300);
1893         fun5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1894         fun5.setResizable(false);
1895         JLabel jl0 = new JLabel("                                                                                                                                                                              ");
1896         JLabel jl1 = new JLabel("                                 ***************************************************************                              ");
1897         JLabel jl2 = new JLabel("                                                                                                                                                                                                                   欢迎"+ku[pass].Getaccountname()+"使用中国工商银行自助柜员系统                                                                                                                                                                                                                   ");
1898         JLabel jl3 = new JLabel("                                 ***************************************************************                              ");
1899         JLabel jl5 = new JLabel("                                                                                                                                                                              ");
1900         JLabel jl7 = new JLabel("                                                     当前账户余额为:"+ku[pass].Getaccountbalance()+"元                                                    ");
1901         JLabel jl6 = new JLabel("                                                                                                                                                                                                                                              ");
1902         JLabel jl8 = new JLabel("                                                                                                                                                                                                                                              ");
1903         JLabel jl4 = new JLabel("账户清单信息为: ");
1904         JLabel jl9 = new JLabel("                                                                                                                                                                                                                                              "); 
1905         c5.add(jl0);
1906         c5.add(jl1);
1907         c5.add(jl2);
1908         c5.add(jl3);
1909         c5.add(jl7);
1910         c5.add(jl9);
1911         c5.add(jl4);
1912         c5.add(jl5);
1913         c5.add(b5t);
1914         c5.add(b5s);
1915         c5.add(jl8);
1916         fun5.add(jt6);
1917         c5.add(jl6);
1918         c5.add(b5);
1919         b5t.setEnabled(false);
1920         b5s.setEnabled(true);
1921     }
1922     //---------------------------<重设>-------------------------------//
1923     //重新设置按钮
1924     //---------------------<细节设置>------------------------------//
1925     //设置时间
1926     private void ResetDate(){
1927         int y,m,d;    
1928         Calendar cal=Calendar.getInstance();    
1929         y=cal.get(Calendar.YEAR);    
1930         m=cal.get(Calendar.MONTH);    
1931         d=cal.get(Calendar.DATE);
1932         String ms;
1933         m++;
1934         if(m<10)
1935             ms = (String)("0"+m);
1936         else
1937             ms = (String)(""+m);
1938         String ds;
1939         if(d<10)
1940             ds = (String)("0"+d);
1941         else
1942             ds = (String)(""+d);
1943         Today = (String)(y+"-"+ms+"-"+ds);
1944     }
1945     //重设按钮
1946     private void ResetButtons(){
1947         //第一个窗口的按钮
1948         bfw.removeAll();
1949         bfw.setText("确定");
1950         //第二个窗口的按钮
1951         bsw.removeAll();
1952         bsw.setText("确定");
1953         //第三个窗口的按钮
1954         bmw.removeAll();
1955         bmw.setText("确定");
1956         //第四个窗口的按钮
1957         b1.removeAll();
1958         b1.setText("确定");
1959         b1s.removeAll();
1960         b1s.setText("确定");
1961         //第五个窗口的按钮
1962         b2.removeAll();
1963         b2.setText("确定");
1964         b2s.removeAll();
1965         b2s.setText("确定");
1966         b2t.removeAll();
1967         b2t.setText("确定");
1968         //第六个窗口的按钮
1969         b3.removeAll();
1970         b3.setText("确定");
1971         b3s.removeAll();
1972         b3s.setText("确定");
1973         b3t.removeAll();
1974         b3t.setText("确定");
1975         b3f.removeAll();
1976         b3f.setText("确定");
1977         //第七个窗口的按钮
1978         b4.removeAll();
1979         b4.setText("确定");
1980         b4s.removeAll();
1981         b4s.setText("确定");
1982         //第八个窗口的按钮
1983         b5.removeAll();
1984         b5.setText("返回");
1985         b5t.removeAll();
1986         b5t.setText("上一条");
1987         b5s.removeAll();
1988         b5s.setText("下一条");
1989     }
1990     //重新设置次数
1991     private void Resettimes(){
1992         times = 0;
1993         times2 = 0;
1994         times3 = 0;
1995         times4 = 0;
1996         times5 = 0;
1997         times6 = 0;
1998         times7 = 0;
1999         times8 = 0;
2000     }
2001     //设置jt6
2002     //设置多选项符卡
2003     //设置多选滑条
2004     private void setJt6() throws FileNotFoundException{
2005         int sx = 1;
2006         Scanner sl = new Scanner (new File(List));
2007         while(true)
2008         {
2009             String str3 = sl.next();//账户
2010             if(str3.compareTo("ENDOFTHISFILE")==0)
2011                 break;
2012             String str1 = sl.next();//日期
2013             String str2 = sl.next();//操作类型
2014             String dateofthis = sl.next();//操作金额
2015             if(ku[pass].GetaccountID().compareTo(str3)==0)
2016             {
2017                 if(sx==TextOfThis)
2018                     jt6.setText(sx+"、"+str1+"  "+str2+"   "+dateofthis);
2019                 sx++;
2020             }
2021         }
2022     }
2023     //返回符合目前登陆账号的信息数
2024     //返回符合当前用户的信息的长度
2025     private int Length() throws FileNotFoundException{
2026         int sx = 0;
2027         Scanner sl = new Scanner (new File(List));
2028         while(true)
2029         {
2030             String str3 = sl.next();//账户
2031             if(str3.compareTo("ENDOFTHISFILE")==0)
2032                 break;
2033             if(ku[pass].GetaccountID().compareTo(str3)==0)
2034                 sx++;
2035         }
2036         return sx;
2037     }
2038     //写入
2039      //将信息写入文件
2040     //写文件
2041     public void writefile() throws IOException{
2042         FileWriter fr = new FileWriter(Infor);
2043         BufferedWriter bw = new BufferedWriter(fr);
2044         PrintWriter fl = new PrintWriter(bw);
2045         for(int i =0;i<5;i++)
2046         {
2047             fl.print(ku[i].GetaccountID());
2048             fl.print(' ');
2049             fl.print(ku[i].Getaccountname());
2050             fl.print(' ');
2051             fl.print(ku[i].Getoperatedate());
2052             fl.print(' ');
2053             fl.print(ku[i].Getoperatetype());
2054             fl.print(' ');
2055             fl.print(ku[i].Getaccountpassword());
2056             fl.print(' ');
2057             fl.print(ku[i].Getaccountbalance());
2058             fl.print(' ');
2059             fl.print(ku[i].Getamount());
2060             fl.print("\n");
2061         }
2062         fl.close();
2063     }
2064     //读文件
2065     public void readfile() throws FileNotFoundException{
2066         Scanner fl = new Scanner(new File(Infor));
2067         for(int i=0;i<5;i++)
2068             ku[i].Set(fl.next(),fl.next(),fl.next(),fl.nextInt(),fl.next(),fl.nextInt(),fl.nextInt());
2069     }
2070     //主函数
2071     public static void main(String[] args) throws FileNotFoundException {
2072         new Test100();
2073     }
2074 }

  好了,一会儿再写一下我的感想啊!就不在这里写了!

  

  

---恢复内容结束---

posted @ 2018-09-24 13:13  初等变换不改变矩阵的秩  阅读(593)  评论(0编辑  收藏  举报