|
|
@@ -39,21 +39,10 @@ public class CashMachineApp extends Application {
|
|
39
|
39
|
areaInfo.setMaxSize(250, 160);
|
|
40
|
40
|
|
|
41
|
41
|
|
|
42
|
|
- Button btnSubmit = new Button("Set Account ID");
|
|
43
|
|
- btnSubmit.setMinSize(250, 40);
|
|
44
|
|
- btnSubmit.setTextFill(blue);
|
|
45
|
|
- btnSubmit.setOnAction(e -> {
|
|
46
|
|
- int id = Integer.parseInt(setAccountIdField.getText());
|
|
47
|
|
- cashMachine.login(id);
|
|
48
|
|
-
|
|
49
|
|
- areaInfo.setText(cashMachine.toString());
|
|
50
|
|
- });
|
|
51
|
|
-
|
|
52
|
42
|
Button btnDeposit = new Button("Deposit");
|
|
53
|
43
|
btnDeposit.setMinSize(250, 40);
|
|
54
|
44
|
btnDeposit.setTextFill(blue);
|
|
55
|
|
-//
|
|
56
|
|
- // btnDeposit.setDisable(true);
|
|
|
45
|
+ btnDeposit.setDisable(true);
|
|
57
|
46
|
btnDeposit.setOnAction(e -> {
|
|
58
|
47
|
int amount = Integer.parseInt(setDepositField.getText());
|
|
59
|
48
|
cashMachine.deposit(amount);
|
|
|
@@ -63,6 +52,7 @@ public class CashMachineApp extends Application {
|
|
63
|
52
|
Button btnWithdraw = new Button("Withdraw");
|
|
64
|
53
|
btnWithdraw.setMinSize(250, 40);
|
|
65
|
54
|
btnWithdraw.setTextFill(blue);
|
|
|
55
|
+ btnWithdraw.setDisable(true);
|
|
66
|
56
|
btnWithdraw.setOnAction(e -> {
|
|
67
|
57
|
int amount = Integer.parseInt(setWithdrawField.getText());
|
|
68
|
58
|
cashMachine.withdraw(amount);
|
|
|
@@ -73,8 +63,32 @@ public class CashMachineApp extends Application {
|
|
73
|
63
|
Button btnExit = new Button("Exit");
|
|
74
|
64
|
btnExit.setMinSize(250, 160);
|
|
75
|
65
|
btnExit.setTextFill(blue);
|
|
|
66
|
+ btnExit.setDisable(true);
|
|
76
|
67
|
btnExit.setOnAction(e -> {
|
|
|
68
|
+ btnDeposit.setDisable(true);
|
|
|
69
|
+ btnWithdraw.setDisable(true);
|
|
|
70
|
+ btnExit.setDisable(true);
|
|
|
71
|
+ resetOnExit();
|
|
77
|
72
|
cashMachine.exit();
|
|
|
73
|
+ areaInfo.setText(cashMachine.toString());
|
|
|
74
|
+ });
|
|
|
75
|
+
|
|
|
76
|
+ Button btnSubmit = new Button("Set Account ID");
|
|
|
77
|
+ btnSubmit.setMinSize(250, 40);
|
|
|
78
|
+ btnSubmit.setTextFill(blue);
|
|
|
79
|
+ btnSubmit.setOnAction(e -> {
|
|
|
80
|
+ int id = Integer.parseInt(setAccountIdField.getText());
|
|
|
81
|
+ if (isValidId(id)){
|
|
|
82
|
+ btnDeposit.setDisable(false);
|
|
|
83
|
+ btnWithdraw.setDisable(false);
|
|
|
84
|
+ btnExit.setDisable(false);
|
|
|
85
|
+ }
|
|
|
86
|
+ else {
|
|
|
87
|
+ btnDeposit.setDisable(true);
|
|
|
88
|
+ btnWithdraw.setDisable(true);
|
|
|
89
|
+ btnExit.setDisable(true);
|
|
|
90
|
+ }
|
|
|
91
|
+ cashMachine.login(id);
|
|
78
|
92
|
|
|
79
|
93
|
areaInfo.setText(cashMachine.toString());
|
|
80
|
94
|
});
|
|
|
@@ -109,6 +123,12 @@ public class CashMachineApp extends Application {
|
|
109
|
123
|
}
|
|
110
|
124
|
}
|
|
111
|
125
|
|
|
|
126
|
+ public void resetOnExit(){
|
|
|
127
|
+ setAccountIdField.clear();
|
|
|
128
|
+ setDepositField.clear();
|
|
|
129
|
+ setWithdrawField.clear();
|
|
|
130
|
+ }
|
|
|
131
|
+
|
|
112
|
132
|
public static void main(String[] args) {
|
|
113
|
133
|
launch(args);
|
|
114
|
134
|
}
|