I am making a simple program that lets you add the results of a race, and how many seconds they used to finish. So to enter the time, I did this:
int time = Integer.parseInt(JOptionPane.showInputDialog("Enter seconds"));
So my question is, how can I display an error message to the user if he enters something other than a positive number? Like a MessageDialog that will give you the error until you enter a number.