I have 3 text fields and a button, and when a user presses the button, I would like to check if he has inserted integer values in the first two of them. If yes, then the sum of both of them is shown in the third one. If not, then a message like "error" goes in the third one. How do I make the check?
Here's some code I wrote (it works fine, exept that it doesn't make a type check) :
@Action
public void selfrename() {
int number1, number2;
jButton1.setText("Show sum");
number1 = Integer.valueOf( jTextField1.getText() ).intValue();
number2 = Integer.valueOf( jTextField2.getText() ).intValue();
jTextField3.setText(Integer.toString(number1 + number2));
}