In a try statement in which the exception is caught how do you prevent the program from displaying error messages
This is is program whereby there exiext a button and a textfield , a figure is entered into the textfield , anytime the user presses the button th efolowing procedure is invoked.
I have written a try statement to check if the correct numbers are inputted, i want to stop the system from printing error messages if the try throws an exception pls how do i do this
public void actionPerformed(ActionEvent ae) {
int b=0;
// validate inputs
try {
Integer.parseInt(maxPoints.getText());
}
catch (NumberFormatException e){
JOptionPane.showMessageDialog(null, "the maximum points value must be a number",
"maximum points", JOptionPane.ERROR_MESSAGE);
}
This is is program whereby there exiext a button and a textfield , a figure is entered into the textfield , anytime the user presses the button th efolowing procedure is invoked.
I have written a try statement to check if the correct numbers are inputted, i want to stop the system from printing error messages if the try throws an exception pls how do i do this
public void actionPerformed(ActionEvent ae) {
int b=0;
// validate inputs
try {
Integer.parseInt(maxPoints.getText());
}
catch (NumberFormatException e){
JOptionPane.showMessageDialog(null, "the maximum points value must be a number",
"maximum points", JOptionPane.ERROR_MESSAGE);
}