1 Reply Latest reply on Jun 8, 2010 6:34 PM by 843807

    username and password

      ok so far ive got the password working

      public void actionPerformed( ActionEvent evt)

      String cmd = evt.getActionCommand();

      if (password.equals(cmd)&& name.equals(cmd))
      *{ //Process the password.*
      char[] input = menupasswordtext.getPassword();
      if (isPasswordCorrect(input))
      *else {*
      *"Invalid password. Try again.",*
      *"Error Message",*
      *private static boolean isPasswordCorrect(char[] input) {*
      boolean isCorrect = true;
      *char[] correctPassword = { 'p', 'a', 's', 's', 'w', 'o', 'r','d' };*
      *if (input.length != correctPassword.length) {*
      isCorrect = false;
      *} else {*
      isCorrect = Arrays.equals (input, correctPassword);

      *//Zero out the password.*

      return isCorrect;

      but im trying now to put together a username with that password but i dont know how to. im using a textfield for the username just trying to put that together with the passwordfield.

      any ideas?
        • 1. Re: username and password
          You need to use code tags to post your code to retain formatting and so the forum software does not corrupt your code. Please post new clean formatted source for your question and use code tags so we can read through uncorrupted code.