Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2004

Tip: Looking for answers? Try searching our database.

How to handle the Cancel button on JOptionPane.showInputDialog

Thread view: 
Bala - 30 Sep 2004 14:52 GMT
I have a input dialog that gets the password. When i enter a value and
click OK it works fine. But when i click Cancel i get a Null Pointer
Exception. How to handle the Cancel button

Any help in this regard would be greatly apprecialted

thanks in advance
Bala
Andrew Thompson - 30 Sep 2004 15:22 GMT
> But when i click Cancel i get a Null Pointer
> Exception. How to handle the Cancel button..

Catch it.

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane

Dirk Gerrit Oort - 30 Sep 2004 15:26 GMT
The api say:
Returns:
user's input, or null meaning the user canceled the input

so test before use on null

Signature

D.G. Oort

>I have a input dialog that gets the password. When i enter a value and
> click OK it works fine. But when i click Cancel i get a Null Pointer
[quoted text clipped - 4 lines]
> thanks in advance
> Bala
Paul Lutus - 30 Sep 2004 16:02 GMT
> I have a input dialog that gets the password. When i enter a value and
> click OK it works fine. But when i click Cancel i get a Null Pointer
> Exception. How to handle the Cancel button

Detect the null and deal with it. One way to deal with it is to assume it
meant the user pressed "Cancel".

Signature

Paul Lutus
http://www.arachnoid.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.