When the JOptionPane opens, I cannot close it with the close-button at the top right of the window. The cause is the for loop but I need it to get sure that the user really inputs digits and not letters. When I try to close the JOptionPane, the catch option runs, and I cannot close the JOptionPane untill I type som digits in the age textfield. Can I get through this problem?
for(;;)
{
try
{
showMessageDialog(this,null,"Input some data", CLOSED_OPTION)
String str_name = name.getText();
int int_age= Integer.parseInt(age.getText());
break;
}catch(NumberFormatException e)
{
JOptionPane.showMessageDialog(this, "Numerical value!","Error", JOptionPane.ERROR_MESSAGE);
}
}