if(ae.getSource() == cal)
{
result.setText("");
try{
//double number1 = Double.parseDouble(amount.getText());
double number1 = errorMessage(amount.getText());
//double number2 = Double.parseDouble(rate.getText());
double number2 = errorMessage(rate.getText());
double res = number1/number2;
result.setText(String.valueOf(res));
}
catch(NumberFormatException n)
{
JOptionPane.showMessageDialog(this, "Only numerics please", "Invalid Number Format",JOptionPane.ERROR_MESSAGE);
}
catch (ArithmeticException d)
{
JOptionPane.showMessageDialog(this, "Don't use zeroes: ", "One of the two numbers is Zero",JOptionPane.ERROR_MESSAGE);
}
catch (myException m)
{
JOptionPane.showMessageDialog(this, "Numbers under 5 only please ", "One of the two numbers is Zero",JOptionPane.ERROR_MESSAGE);
}
amount.setText("");
rate.setText("");
}
if(ae.getSource() == dum)
{
}