Przeglądaj źródła

{fancy lil calc}

Jacqueline Joson 6 lat temu
rodzic
commit
f31829d9fb

+ 8
- 4
src/main/java/rocks/zipcode/calcskin/CalcEngine.java Wyświetl plik

@@ -6,18 +6,22 @@ public class CalcEngine {
6 6
     }
7 7
 
8 8
     public double add(double v, double v1) {
9
-        return Double.NaN;
9
+       double sum =  v + v1;
10
+       return sum;
10 11
     }
11 12
 
12 13
     public double subtract(double v, double v1) {
13
-        return Double.NaN;
14
+        double difference = v - v1;
15
+        return difference;
14 16
     }
15 17
 
16 18
     public double multiply(double v, double v1) {
17
-        return Double.NaN;
19
+        double product = v * v1;
20
+        return product;
18 21
     }
19 22
 
20 23
     public double divide(double v, double v1) {
21
-        return Double.NaN;
24
+        double dividend = v / v1;
25
+        return dividend;
22 26
     }
23 27
 }

+ 4
- 4
src/main/java/rocks/zipcode/calcskin/CalcSkin.java Wyświetl plik

@@ -60,7 +60,7 @@ public class CalcSkin extends Application {
60 60
     private VBox createLayout(TextField screen, TilePane buttons) {
61 61
         final VBox layout = new VBox(20);
62 62
         layout.setAlignment(Pos.CENTER);
63
-        layout.setStyle("-fx-background-color: silver; -fx-padding: 20; -fx-font-size: 20;");
63
+        layout.setStyle("-fx-background-color: #6c1d45; -fx-padding: 20; -fx-font-size: 20;");
64 64
         layout.getChildren().setAll(screen, buttons);
65 65
         handleAccelerators(layout);
66 66
         screen.prefWidthProperty().bind(buttons.widthProperty());
@@ -81,7 +81,7 @@ public class CalcSkin extends Application {
81 81
 
82 82
     private TextField createScreen() {
83 83
         final TextField screen = new TextField();
84
-        screen.setStyle("-fx-background-color: aquamarine;");
84
+        screen.setStyle("-fx-background-color: #a39382");
85 85
         screen.setAlignment(Pos.CENTER_RIGHT);
86 86
         screen.setEditable(false);
87 87
         screen.textProperty().bind(Bindings.format("%.0f", currentValue));
@@ -143,7 +143,7 @@ public class CalcSkin extends Application {
143 143
 
144 144
     private Button makeStandardButton(String s) {
145 145
         Button button = new Button(s);
146
-        button.setStyle("-fx-base: beige;");
146
+        button.setStyle("-fx-base: #002855");
147 147
         accelerators.put(s, button);
148 148
         button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
149 149
         return button;
@@ -166,7 +166,7 @@ public class CalcSkin extends Application {
166 166
     }
167 167
 
168 168
     private void makeClearButton(Button button) {
169
-        button.setStyle("-fx-base: mistyrose;");
169
+        button.setStyle("-fx-base: #36573b");
170 170
         button.setOnAction(new EventHandler<ActionEvent>() {
171 171
             @Override
172 172
             public void handle(ActionEvent actionEvent) {