Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2007, 04:43 PM
Member
 
Join Date: May 2007
Posts: 39
Nick15 is on a distinguished road
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
Code:
try { temp=Password.getPassword()[n]; } 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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-14-2007, 05:47 PM
Member
 
Join Date: May 2007
Posts: 42
Freddie is on a distinguished road
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 ..... )

regards

Last edited by Freddie : 06-01-2007 at 03:48 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 03:16 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org