VALIDATING INPUT
Here is a good way to validate numeric input.
(Other useful methods in JAVA book, page 51.)
boolean inputOK = false;
while (!inputOK) // loop repeats until input is valid
{ if ( isValid(Xfield) )
{ x = getNumber(Xfield);
inputOK = true;
}
else
{ messageBox
("Input must be an integer.");
}
} // end of loop