⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverwindows.java

📁 模拟银行的ATM自动取款机
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="提交"){
         if(idCardText.getText().equals("")||nameText.getText().equals("")||idText.getText().equals("")||passwordText.getText().equals("")||repassword.getText().equals("")){
            new noText();
         }else{
            String s=idCardText.getText();
            if(s.length()!=15&&s.length()!=18){
               setVisible(false);
               new newManagerError(manager,1);
            }else{
            
               String p1=passwordText.getText();
               String p2=repasswordText.getText();
               if(p1.equals(p2)){
                  int i=0;
                  if(superManager.getState())  i=1;
                  ManagerOperate m=new ManagerOperate();
                  m.CreateManager(idText.getText(),p1,nameText.getText(),idCardText.getText(),i);
                  setVisible(false);
                  new Manage(manager);
               }
               else{
                  setVisible(false);
                  new newManagerError(manager,2);
               }
            }
         }
      }
      if(command=="返回"){
         setVisible(false);
         new Manage(manager);
      }
   }
   
   public void itemStateChanged(ItemEvent ie){}
}

class noPrompt extends Frame implements ActionListener{
   Label title;
   Button enter;
   ManagerOperate manager;
   
   public noPrompt(ManagerOperate manager){
      this.manager=manager;
      title=new Label("非超级管理员,无权限执行该项操作!");
      enter=new Button("确定");
      
      setBackground(Color.lightGray);
      setLocation(300,300);
      setSize(400,150);
      setLayout(new FlowLayout());
      
      Container con0=new Container();
      Font font=new Font("Arial",Font.BOLD,18);
      con0.setFont(font);
      con0.setLayout(new FlowLayout());
      con0.add(title);
      
      Container con1=new Container();
      con1.setLayout(new FlowLayout());
      con1.add(enter);
      
      add(con0);
      add(con1);
      
      enter.addActionListener(this);
      
      setVisible(true);
   }
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="确定"){
         setVisible(false);
         new Manage(manager);
      }
   }
}

class newManagerError extends Frame implements ActionListener{
   Label title;
   Button enter;
   ManagerOperate manager;
   
   public newManagerError(ManagerOperate manager,int state){
      this.manager=manager;
      
      if(state==2){
         title=new Label("密码输入不正确!");
         
      }
      else{
         
         title=new Label("身份证号位数错误!");
      }
      enter=new Button("确定");
      setBackground(Color.lightGray);
      setLocation(300,300);
      setSize(400,150);
      setLayout(new FlowLayout());
      
      Container con0=new Container();
      Font font=new Font("Arial",Font.BOLD,24);
      con0.setFont(font);
      con0.setLayout(new FlowLayout());
      con0.add(title);
      
      Container con1=new Container();
      con1.setLayout(new FlowLayout());
      con1.add(enter);
      
      enter.addActionListener(this);
      
      add(con0);
      add(con1);
      
      setVisible(true);
   }
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="确定"){
         setVisible(false);
         new newManager(manager);
      }
   }
}
      
      
      
      

class changePassword extends Frame implements ActionListener{
   Label title;
   Label input;
   Label reinput;
   TextField password;
   TextField repassword;
   Button enter;
   Button back;
   ManagerOperate manager;
   
   
   public changePassword(ManagerOperate manager){
      this.manager=manager;
      
      title=new Label("密码修改");
      input=new Label("输入密码");
      reinput=new Label("重新输入密码");
      password=new TextField(10);
      repassword=new TextField(10);
      enter=new Button("确定");
      back=new Button("返回");
      
      setBackground(Color.lightGray);
      setLocation(200,200);
      setSize(300,250);
      setLayout(new GridLayout(4,1));
      
      Container con0=new Container();
      Font font=new Font("Arial",Font.BOLD,24);
      con0.setFont(font);
      con0.setLayout(new FlowLayout());
      con0.add(title);
      
      Container con1=new Container();
      con1.setLayout(new FlowLayout());
      con1.add(input);
      con1.add(password);
      password.setEchoChar('*');
      
      Container con2=new Container();
      con2.setLayout(new FlowLayout());
      con2.add(reinput);
      con2.add(repassword);
      repassword.setEchoChar('*');
      
      Container con3=new Container();
      con3.setLayout(new FlowLayout());
      con3.add(enter);
      con3.add(back);
      
      enter.addActionListener(this);
      back.addActionListener(this);
      
      
      add(con0);
      add(con1);
      add(con2);
      add(con3);
      
      setVisible(true);
   }
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="返回"){
         setVisible(false);
         new Manage(manager);
      }
      if(command=="确定"){
         if(password.getText().equals("")||repassword.getText().equals("")){
            new noText();
         }
         else{
         if(password.getText().equals(repassword.getText())){
            setVisible(false);
            manager.ModifyCode(password.getText(),manager.getid());
            new changeOk(manager);
         }
         else{
            setVisible(false);
            new changeError(manager);
         }
      }
         
      }
   }
}


class changeOk extends Frame implements ActionListener{
   Label lab;
   Button back;
   ManagerOperate manager;
   
   public changeOk(ManagerOperate manager){
      this.manager=manager;
      
      lab=new Label("密码修改成功!");
      back=new Button("返回");
      
      setSize(300,150);
      setBackground(Color.lightGray);
      setLocation(200,200);
      setLayout(new GridLayout(2,1));
      
      Container con0=new Container();
      con0.setLayout(new FlowLayout());
      Font font=new Font("Arial",Font.BOLD,24);
      con0.setFont(font);
      con0.add(lab);
      
      Container con1=new Container();
      con1.setLayout(new FlowLayout());
      con1.add(back);
      
      back.addActionListener(this);
      
      add(con0);
      add(con1);
      
      setVisible(true);
   }
   
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="返回"){
         setVisible(false);
         new Manage(manager);
      }
   }
}
      


class changeError extends Frame implements ActionListener{
   Label lab;
   Button back;
   ManagerOperate manager;
   
   public changeError(ManagerOperate manager){
      
      this.manager=manager;
      lab=new Label("密码修改失败!");
      back=new Button("返回");
      
      setSize(300,150);
      setBackground(Color.lightGray);
      setLocation(200,200);
      setLayout(new GridLayout(2,1));
      
      Container con0=new Container();
      con0.setLayout(new FlowLayout());
      Font font=new Font("Arial",Font.BOLD,24);
      con0.setFont(font);
      con0.add(lab);
      
      Container con1=new Container();
      con1.setLayout(new FlowLayout());
      con1.add(back);
      
      back.addActionListener(this);
      
      add(con0);
      add(con1);
      
      setVisible(true);
   }
   
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="返回"){
         setVisible(false);
         new Manage(manager);
      }
   }
}

class userLoginError extends Frame implements ActionListener{
   Label lab;
   Button back;
   ManagerOperate manager;
   
   public userLoginError(ManagerOperate manager){
      this.manager=manager;
      
      lab=new Label("帐户或密码错误,请重新登录!!");
      back=new Button("返回");
      
      setBackground(Color.lightGray);
      setLocation(300,300);
      setSize(400,150);
      setLayout(new BorderLayout());
      
      Container con1=new Container();
      Font font=new Font("Arial",Font.BOLD,24);
      con1.setFont(font);
      con1.setLayout(new FlowLayout());
      con1.add(lab);
      
      Container con2=new Container();
      Font font1=new Font("Arial",Font.PLAIN,16);
      con2.setFont(font1);
      con2.setLayout(new FlowLayout());
      con2.add(back);
      
      add(con1,BorderLayout.CENTER);
      add(con2,BorderLayout.SOUTH);
      
      back.addActionListener(this);
      
      setVisible(true);
   }
   
    public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="返回"){
         this.setVisible(false);
         new Manage(manager);
      }
   }
}


class userLogin extends Frame implements ActionListener{
   Label title;
   Label inputId;
   Label inputPassword;
   TextField idText;
   TextField passwordText;
   Button enter;
   Button back;
   ManagerOperate manager;
   Employer account;
   
   public userLogin(ManagerOperate manager){
      this.manager=manager;
      
      title=new Label("帐户登录");
      inputId=new Label("输入用户帐号");
      inputPassword=new Label("输入用户密码");
      idText=new TextField(10);
      passwordText=new TextField(10);
      enter=new Button("确定");
      back=new Button("返回");
      
      
      setSize(300,250);
      setBackground(Color.lightGray);
      setLocation(200,200);
      setLayout(new GridLayout(4,1));
      
      Container con0=new Container();
      con0.setLayout(new FlowLayout());
      Font font=new Font("Arial",Font.BOLD,24);
      con0.setFont(font);
      con0.add(title);
      
      Container con1=new Container();
      con1.setLayout(new FlowLayout());
      con1.add(inputId);
      con1.add(idText);
      
      Container con2=new Container();
      con2.setLayout(new FlowLayout());
      con2.add(inputPassword);
      con2.add(passwordText);
      passwordText.setEchoChar('*');
      
      Container con3=new Container();
      con3.setLayout(new FlowLayout());
      con3.add(enter);
      con3.add(back);
      
      back.addActionListener(this);
      enter.addActionListener(this);
      
      add(con0);
      add(con1);
      add(con2);
      add(con3);
      
      setVisible(true);
   }
   
   public void actionPerformed(ActionEvent ae){
      String command=(String)ae.getActionCommand();
      if(command=="返回"){
         setVisible(false);
         new Manage(manager);
      }
      if(command=="确定"){
         setVisible(false);
         account=new Employer(manager.getid());
         int i=account.IsAccountExsit(idText.getText());
         boolean p=account.checkPassWordCustomer(passwordText.getText());
         if(i!=1||!p){
            setVisible(false);
            new userLoginError(manager);
         }
         else{
            new operateUser(manager,account);
         }
      }
   }
}




class operateUser extends Frame implements ActionListener{
   Label title;
   Button save;
   Button draw;
   Button query;
   Button pay;
   Button over;
   Button changePassword;
   Button delete;
   Button moveMoney;
   ManagerOperate manager;
   Employer account;
   
   public operateUser(ManagerOperate manager,Employer account){
      this.manager=manager;
      this.account=account;
      
      title=new Label("帐户操作窗口");
      
      save=new Button("存款");
      draw=new Button("取款");
      query=new Button("帐户查询");
      pay=new Button("代理缴费");
      changePassword=new Button("修改密码");
      over=new Button("操作结束");
      delete=new Button("帐户注销");
      moveMoney=new Button("转帐");
      
      
      setSize(350,300);
      setBackground(Color.lightGray);
      setLocation(200,200);
      setLayout(new FlowLayout());
      
      
      Container con0=new Container();
      con0.setLayout(new FlowLayout());
      Font font=new Font("Arial",Font.BOLD,24);
      con0.setFont(font);
      con0.add(title);
      
      
      Container con1=new Container();
      con1.setLayout(new GridLayout(4,2,30,20));
      Font f=new Font("Arial",Font.PLAIN,16);
      con1.setFont(f);
      con1.add(save);
      con1.add(draw);
      con1.add(query);
      con1.add(changePassword);
      con1.add(moveMoney);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -