Browse files

after equals output

  • Loading branch information...
1 parent 9adc104 commit d48794926c94550a6514263e26ce68119c24f830 @AirVan21 committed Apr 21, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 HW6.ex1/src/hw6/ex1/Calculator.java
View
10 HW6.ex1/src/hw6/ex1/Calculator.java
@@ -92,7 +92,12 @@ public NumberListener(String value) {
@Override
public void actionPerformed(ActionEvent e) {
- text.setText(text.getText() + value);
+ if (!clearScreen) {
+ text.setText(text.getText() + value);}
+ else {
+ text.setText(value);
+ clearScreen = false;
+ }
}
private String value;
@@ -456,6 +461,7 @@ private void equalsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
if (!mistake) {
previousAction = startAction;
printer(memory);
+ clearScreen = true;
}
}//GEN-LAST:event_equalsActionPerformed
@@ -501,6 +507,8 @@ public void run() {
});
}
+ private boolean clearScreen;
+
private final char startAction = '%';
private char previousAction;

0 comments on commit d487949

Please sign in to comment.