瀏覽代碼

workind calculator with exponent, sqrt, invert and square

mpierse 6 年之前
父節點
當前提交
2394b703e8
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3
    3
      src/main/java/rocks/zipcode/calcskin/CalcSkin.java

+ 3
- 3
src/main/java/rocks/zipcode/calcskin/CalcSkin.java 查看文件

@@ -36,7 +36,7 @@ public class CalcSkin extends Application {
36 36
     private DoubleProperty currentValue = new SimpleDoubleProperty();
37 37
     private CalcEngine calcEngine = new CalcEngine();
38 38
 
39
-    private enum Op { NOOP, ADD, SUBTRACT, MULTIPLY, DIVIDE, SQUARED, SQUAREROOT, INVERT, EXPONENT  }
39
+    private enum Op { NOOP, ADD, SUBTRACT, MULTIPLY, DIVIDE, EXPONENT  }
40 40
 
41 41
     private Op curOp   = Op.NOOP;
42 42
     private Op stackOp = Op.NOOP;
@@ -84,7 +84,7 @@ public class CalcSkin extends Application {
84 84
         screen.setStyle("-fx-background-color: aquamarine;");
85 85
         screen.setAlignment(Pos.CENTER_RIGHT);
86 86
         screen.setEditable(false);
87
-        screen.textProperty().bind(Bindings.format("%.0f", currentValue));
87
+        screen.textProperty().bind(Bindings.format("%.4f", currentValue));
88 88
         return screen;
89 89
     }
90 90
 
@@ -118,7 +118,7 @@ public class CalcSkin extends Application {
118 118
                 makeSquareButton(button);
119 119
             } else if ("sqrt".equals(s)){
120 120
                 makeSquareRootButton(button);
121
-            } else if ("i/x".equals(s)){
121
+            } else if ("1/x".equals(s)){
122 122
                 makeInvertButton(button);
123 123
             }
124 124
         }