Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Blank input dialog box ....... error??

Hi Everyone,

I am using the following code to accept inputs from the user:

String input = JOptionPane.showInputDialog("Input:");

Now the problem is ... if the user presses cancel .... i have made the system to exit without the error bit .... but if the user enters nothing ... it gives an error .... how can i fix this problem ?? something like a custom message and make the program ask for the input again would be a better option but a simple exit will work as well ...

Thanks in advance
[525 byte] By [neo22] at [2007-11-11 8:09:36]
# 1 Re: Blank input dialog box ....... error??
if (input == null || input.equals(""))
System.exit(0);
Phaelax at 2007-11-11 22:36:18 >