Strange that you got a NullPointerException. You need a null to get that.
Type: Posts; User: Norm
Strange that you got a NullPointerException. You need a null to get that.
Read the API doc for the class. Go to this site and Find the JOptionPane class.
Java Platform SE 6
and then find the method in that classs that you are interested in.
Your code does not consider this:
What are the values that the showInputDialog can return? Can it return a null value?
A variable with a null value can not be used to call a method: ...
What variable has a null value at line 25? Check back in your code to see why that variable does not have a valid value and change the code so that it does have a valid value.
What are the values...
Which part don't you understand?
Detecting when the user pressed Cancel?
Have you read ALL the API doc for the method you are using? It is explained there.
Displaying an error message?
Again...
How do you detect if the user hit the Cancel button? Does the method you have called return any indication of that? If so, you can use that information to make your decision.
Pseudo code:
show...