Package niso

Examples of niso.User


      //Get the users
      Users.removeAll(Users);
      try{
        ResultSet RS=Parent.getDBHandler().MySQLSelect("SELECT * from UserAccount where UserName!='"+Parent.getUser().getUserName()+"';");
        while(RS.next())
          Users.add(new User(RS.getString(1),RS.getString(2),RS.getString(3)));
        RS.close();
      }catch(Exception ex){System.out.println("Problem "+ex);}
      cb.removeAllItems();
     
      for(int ctr=0;ctr<Users.size();ctr++){
View Full Code Here


  public void setListItems(JList L){
    Users.removeAll(Users);
    try{
      ResultSet RS=Parent.getDBHandler().MySQLSelect("SELECT * from UserAccount;");
      while(RS.next())
        Users.add(new User(RS.getString(1),RS.getString(2),RS.getString(3)));
      RS.close();
    }catch(Exception ex){System.out.println("Problem "+ex);}
   
    String[] S=new String[Users.size()];
   
View Full Code Here

 

  @Override
  public void itemStateChanged(ItemEvent IE) {
    if(IE.getSource()==UserBox&&UserBox.getItemCount()>0){
      User Selected=Users.get(UserBox.getSelectedIndex());
      NameBox.setText(Selected.getUserName());
      PassBox.setText(Selected.getUserPassword());
      UserTypeBox.setSelectedItem(Selected.getusertype());
    }
    else SaveModificationsBt.setEnabled(true);
  }
View Full Code Here

      }
      setComboBoxItems(UserBox);
      setComboBoxItems(DelUserBox);
    }
    else if(AE.getSource()==SaveModificationsBt&&NameBox.getText().length()>0){
      User Selected=Users.get(UserBox.getSelectedIndex());
      String name=Selected.getUserName(),Pass=Selected.getUserPassword();
      try {
        DBH.MySQLUpdate("UPDATE UserAccount SET Username='"+NameBox.getText()+"',Password='"+PassBox.getText()
            +"',UserType='"+UserTypeBox.getSelectedItem()+"' WHERE Username='"+UserBox.getSelectedItem()+"';");
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        NameBox.setText(name);
        PassBox.setText(Pass);
        ErrorMod.setFont(Parent.getWarningFont(ErrorMod));
        ErrorMod.setText("Error. Modification did not occur");
       
      }
     
      String s=NameBox.getText();
      Selected.reNameUser(s);
      Selected.changePassword(PassBox.getText());
      Selected.changeUserType(UserTypeBox.getSelectedItem().toString());
      setComboBoxItems(UserBox);
      setComboBoxItems(DelUserBox);
      UserBox.setSelectedItem(s);
      setListItems(UserList);
      SaveModificationsBt.setEnabled(false);
View Full Code Here

  }

  @Override
  public void focusLost(FocusEvent FE) {
    ErrorMod.setText("");
    User Selected=Users.get(UserBox.getSelectedIndex());
    ErrorMod.setFont(Parent.getWarningFont(ErrorMod));
    if(NameBox.getText().length()<=0){
      NameBox.setText(ChangeTest);
      ErrorMod.setText("Modification unsaved: Don't leave textboxes empty");
    }
    else if(PassBox.getText().length()<=0){
      PassBox.setText(ChangeTest);
      ErrorMod.setText("Mofification unsaved: Don't leave textboxes empty");
    }
    else if((!Selected.getUserName().equalsIgnoreCase(NameBox.getText())&&focus==NameBox)||(!Selected.getUserPassword().equals(PassBox.getText())&&focus==PassBox))
      SaveModificationsBt.setEnabled(true);
   
    focus=null;
    CheckLbl.setIcon(null);
    CheckLbl.setText("");
View Full Code Here

  }

  @Override
  public void valueChanged(ListSelectionEvent LE) {
    // TODO Auto-generated method stub
    User Selected=Users.get(UserList.getSelectedIndex());
    NameBox.setText(Selected.getUserName());
    PassBox.setText(Selected.getUserPassword());
    UserTypeBox.setSelectedItem(Selected.getusertype());
  }
View Full Code Here

        AddPass.setEditable(true);
      else AddPass.setEditable(false);
       
    }
    else if(!UpdateMode.isEnabled()){
      User Selected =Users.get(UserBox.getSelectedIndex());
      if(Selected.getUserName().equalsIgnoreCase(NameBox.getText())&&Selected.getUserPassword().equals(PassBox.getText()))
        SaveModificationsBt.setEnabled(false);
      else if (!Selected.getUserName().equalsIgnoreCase(NameBox.getText())||!Selected.getUserPassword().equals(PassBox.getText()))
        SaveModificationsBt.setEnabled(true);
    }
   
   
  }
View Full Code Here

    this.curFrame=n;
    this.parent=parent;
    this.setLayout(null);
    corPass=false;
    corUsrName=false;
    tempUser= new User("","","");
    db = new DBHandler(3306, "nisodb", "root", "p@ssword");
    back =  new Button("images/back.png", "images/back2.png", "images/back2a.png");
    login = new Button("images/l"+n+".png", "images/l"+n+"a.png", "images/l"+n+".png");
   
    try {
View Full Code Here

            break;
      }
     

      while(RS.next()){
        User temp = new User("", "", "");
        temp.reNameUser(RS.getString("username"));
        temp.changePassword(RS.getString("password"));
        temp.changeUserType(RS.getString(3));
        users.add(temp);
     
        RS.close();
     
    }catch(Exception ex){
View Full Code Here

TOP

Related Classes of niso.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.