I'm having trouble getting my InputMismatch working on my program. Do I need some kind of throw for this exception? The program compiles fine, but it dosen't pick up the exception. Can someone please help.
public class EndingListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("Convert")){
try{
int base10;
String message, base2;
message = userField1.getText();
BaseConversion test = new BaseConversion();
base10 = Integer.parseInt( message );
base2 = test.stackreturn(base10);
userField2.setText(base2.toString());
}
catch ( InputMismatchException inputMismatchException ){
userField2.setText("Please Enter a Number");
}
}
if (e.getActionCommand().equals("Clear"))
{
userField1.setText("");
userField2.setText("");
}
}
}