if (e.getSource() == key.equal) {
theSecondNum = Float.parseFloat(result.tf.getText());
if (operation.equals("")) {
result.tf.setText("0");
}
if (operation.equals("add"))
result.tf.setText(String.valueOf(theFirstNum + theSecondNum));
if (operation.equals("subtract"))
result.tf.setText(String.valueOf(theFirstNum - theSecondNum));
if (operation.equals("multiplay"))
result.tf.setText(String.valueOf(theFirstNum * theSecondNum));
if (operation.equals("divide")) {
if (result.tf.getText().equals("0"))
result.tf.setText("Error");
else
result.tf.setText(String
.valueOf(theFirstNum / theSecondNum));
}
if (operation.equals("mod")) {
if (result.tf.getText().equals("0"))
result.tf.setText("Error");
else
result.tf.setText(String
.valueOf(theFirstNum % theSecondNum));
}
isInit = true;
theFirstNum = 0;
theSecondNum = 0;
operation = "";
}
theSecondNum = Float.parseFloat(result.tf.getText());
if (operation.equals("")) {
result.tf.setText("0");
}
if (operation.equals("add"))
result.tf.setText(String.valueOf(theFirstNum + theSecondNum));
if (operation.equals("subtract"))
result.tf.setText(String.valueOf(theFirstNum - theSecondNum));
if (operation.equals("multiplay"))
result.tf.setText(String.valueOf(theFirstNum * theSecondNum));
if (operation.equals("divide")) {
if (result.tf.getText().equals("0"))
result.tf.setText("Error");
else
result.tf.setText(String
.valueOf(theFirstNum / theSecondNum));
}
if (operation.equals("mod")) {
if (result.tf.getText().equals("0"))
result.tf.setText("Error");
else
result.tf.setText(String
.valueOf(theFirstNum % theSecondNum));
}
isInit = true;
theFirstNum = 0;
theSecondNum = 0;
operation = "";
}