Results 1 to 2 of 2
  1. #1
    Nick15 is offline Member
    Join Date
    May 2007
    Rep Power

    Default Jpassword problem

    I'm using JPassword and KeyReleased event, when a key is pressed as "ctrl" and in the event I ask with getPassword for the first digit of the password, ctrl does not generate a character, it generates an exception java.lang. ArrayIndexOutOfBoundsException.

    I tried with the following instruction to avoid the exception and worked out, but in the temp var (that is char type) didn't save anything
    Java Code:
    catch (ArrayIndexOutOfBoundsException e){}
    How can I avoid the exception ?
    what do I save in temp when I press ctrl ó Alt??
    How can I ask if temp var is null?

    Thanks you
    Last edited by Nick15; 06-01-2007 at 01:37 AM.

  2. #2
    Freddie is offline Member
    Join Date
    May 2007
    Rep Power


    Maybe, it would be better obtain the key entered from keyevent parameter that received the listener

    To avoid the exception ArrayIndexOutOfBounds you could use the attribute .length of the array
    if (Password.getPassword().length ..... )

    Last edited by Freddie; 06-01-2007 at 03:48 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts