I was wondering how you would go about outputting which of the two text boxes is holding the NumberFormatException.
try
{
num1Convert = Integer.parseInt(num1Str);
num2Convert = Integer.parseInt(num2Str);
sumValue = num1Convert + num2Convert;
sumLabel.setText(sumText + Integer.toString(sumValue));
}
catch(NumberFormatException nfe)
{
errorLabel.setText((HERE IS WHERE I NEED TO PUT CODE TO SAY WHICH TEXTFIELD IT IS" must be an integer");
num1.requestFocus();
}
my program compares two numbers, and then returns the value of the numbers added together, but I need to output which of the two textareas are throwing back the exception, but I don't know how to do this. I have wrote within the code where it is necessary to output it.