Package fileInteraction

Examples of fileInteraction.UserFileWriter


  public void addHighScore(HighScore highScore) {
    highScores.add(highScore);
   
    Collections.sort(highScores, new HighScoreComparator());
   
    UserFileWriter userFileWriter = new UserFileWriter();
    userFileWriter.adjustUser(this);
  }
View Full Code Here


  public void closeFrame() {
    editUserFrame.dispose();
  }

  public void editUser(String username, char[] password, char[] newPassword, char[] retypePassword, String alias) {
    UserFileWriter userFileWriter = new UserFileWriter();

    if (password.length == 0) {
      JOptionPane.showMessageDialog(null, "Please enter your current password.",
           "Error",
           JOptionPane.ERROR_MESSAGE);
    } else if (!CryptoManager.checkPass(new String(password), user)) {
      JOptionPane.showMessageDialog(null, "Please enter the correct current password.",
           "Error",
           JOptionPane.ERROR_MESSAGE);
    } else if ("".equals(alias.trim())) {
      JOptionPane.showMessageDialog(null, "Please enter an alias.",
           "Error",
           JOptionPane.ERROR_MESSAGE);
    } else if (!new String(newPassword).equals(new String(retypePassword))) {
      JOptionPane.showMessageDialog(null, "The new password and the retype password do not match.",
           "Error",
           JOptionPane.ERROR_MESSAGE);
    } else {
      ArrayList<Friend> friends = abstractLoungeModel.getCurrentUser().getFriends();
     
      if (newPassword.length == 0 && retypePassword.length == 0) {
        user = new User(username, new String(password), alias, null, 0);       
      } else {
        user = new User(username, new String(newPassword), alias, null, 0);
      }
     
      user.getFriends().addAll(friends);
     
      userFileWriter.adjustUser(user);

      closeFrame();
     
      JOptionPane.showMessageDialog(null, "Profile edited",
           "Edited",
View Full Code Here

    fireStateChanged();
  }

  public void saveUser() {
    UserFileWriter userFileWriter = new UserFileWriter();
    userFileWriter.adjustUser(super.getCurrentUser());
  }
View Full Code Here

      }
    }
  }

  public void createUser(String alias) {
    UserFileWriter userFileWriter = new UserFileWriter();

    try {
      User user = null;
      try {
        user = new User(userName, password, alias, InetAddress.getLocalHost(), 0);
        System.out.println(InetAddress.getLocalHost().getHostAddress());
      } catch (UnknownHostException ex) {
      }
      userFileWriter.addNewUser(user);

      registerFrame.dispose();

      JOptionPane.showMessageDialog(null, "The account is created, you can now log in.",
         "Account created",
View Full Code Here

TOP

Related Classes of fileInteraction.UserFileWriter

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.