Browse Source

Not Broken

Added 2 popups for Overdrawn, Insufficient
Added disable/ enable buttons
changed to float
Combined Deposit/ Withdrawal button
Nick Satinover 6 years ago
parent
commit
11576f65ff
1 changed files with 4 additions and 6 deletions
  1. 4
    6
      src/main/java/rocks/zipcode/atm/CashMachineApp.java

+ 4
- 6
src/main/java/rocks/zipcode/atm/CashMachineApp.java View File

@@ -17,7 +17,6 @@ import javafx.scene.paint.Color;
17 17
  */
18 18
 public class CashMachineApp extends Application {
19 19
     Color blue = Color.rgb(0,0,255);
20
-    // Color green = Color.rgb(0,255,255);
21 20
 
22 21
     private CashMachine cashMachine = new CashMachine(new Bank());
23 22
 
@@ -44,7 +43,7 @@ public class CashMachineApp extends Application {
44 43
         btnDeposit.setTextFill(blue);
45 44
         btnDeposit.setDisable(true);
46 45
         btnDeposit.setOnAction(e -> {
47
-            float amount = Float.parseFloat(setDepositField.getText());
46
+            float amount = Float.parseFloat(setWithdrawField.getText());
48 47
             cashMachine.deposit(amount);
49 48
             areaInfo.setText(cashMachine.toString());
50 49
         });
@@ -56,7 +55,6 @@ public class CashMachineApp extends Application {
56 55
         btnWithdraw.setOnAction(e -> {
57 56
             float amount = Float.parseFloat(setWithdrawField.getText());
58 57
             cashMachine.withdraw(amount);
59
-
60 58
             areaInfo.setText(cashMachine.toString());
61 59
         });
62 60
 
@@ -99,11 +97,11 @@ public class CashMachineApp extends Application {
99 97
         GridPane.setConstraints(btnWithdraw, 0, 2);
100 98
         GridPane.setConstraints(btnExit, 0, 3);
101 99
         GridPane.setConstraints(setAccountIdField, 1, 0);
102
-        GridPane.setConstraints(setDepositField, 1, 1);
103
-        GridPane.setConstraints(setWithdrawField,1, 2);
100
+        setWithdrawField.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
101
+        GridPane.setConstraints(setWithdrawField, 1, 1, 1, 2);
104 102
         GridPane.setConstraints(areaInfo, 1, 3);
105 103
         gridPane.getChildren().addAll(btnSubmit, btnDeposit, btnWithdraw, btnExit,
106
-                setAccountIdField, setDepositField, setWithdrawField, areaInfo);
104
+                setAccountIdField, setWithdrawField, areaInfo);
107 105
         return gridPane;
108 106
     }
109 107