|
@@ -1,5 +1,7 @@
|
1
|
1
|
package rocks.zipcode.atm;
|
2
|
2
|
|
|
3
|
+import javafx.scene.control.Label;
|
|
4
|
+import javafx.stage.StageStyle;
|
3
|
5
|
import rocks.zipcode.atm.bank.Bank;
|
4
|
6
|
import javafx.application.Application;
|
5
|
7
|
import javafx.scene.Parent;
|
|
@@ -17,25 +19,44 @@ import javafx.scene.layout.FlowPane;
|
17
|
19
|
public class CashMachineApp extends Application {
|
18
|
20
|
|
19
|
21
|
private TextField field = new TextField();
|
|
22
|
+ private TextField field2 = new TextField();
|
20
|
23
|
private CashMachine cashMachine = new CashMachine(new Bank());
|
21
|
24
|
|
|
25
|
+
|
22
|
26
|
private Parent createContent() {
|
23
|
27
|
VBox vbox = new VBox(10);
|
24
|
28
|
vbox.setPrefSize(600, 600);
|
|
29
|
+ vbox.setStyle("-fx-background-color: silver; -fx-padding: 20; -fx-font-size: 20;");
|
25
|
30
|
|
26
|
31
|
TextArea areaInfo = new TextArea();
|
27
|
32
|
|
28
|
|
- Button btnSubmit = new Button("Set Account ID");
|
|
33
|
+ Button btnSubmit = new Button("Enter");
|
29
|
34
|
btnSubmit.setOnAction(e -> {
|
30
|
35
|
int id = Integer.parseInt(field.getText());
|
31
|
36
|
cashMachine.login(id);
|
32
|
37
|
|
33
|
38
|
areaInfo.setText(cashMachine.toString());
|
34
|
39
|
});
|
|
40
|
+/*
|
|
41
|
+ //Make Button Do something.
|
|
42
|
+ Button btnNewAccount = new Button("Setup New Account");
|
|
43
|
+ btnSubmit.setOnAction(e -> {
|
|
44
|
+ int id = Integer.parseInt(field.getText());
|
|
45
|
+ cashMachine.login(id);
|
|
46
|
+
|
|
47
|
+ });
|
35
|
48
|
|
|
49
|
+ //Make Button Do something.
|
|
50
|
+ Button btnForgotAccountNumber = new Button("Forgot Account Number");
|
|
51
|
+ btnSubmit.setOnAction(e -> {
|
|
52
|
+ int id = Integer.parseInt(field.getText());
|
|
53
|
+ cashMachine.login(id);
|
|
54
|
+
|
|
55
|
+ });
|
|
56
|
+*/
|
36
|
57
|
Button btnDeposit = new Button("Deposit");
|
37
|
58
|
btnDeposit.setOnAction(e -> {
|
38
|
|
- int amount = Integer.parseInt(field.getText());
|
|
59
|
+ int amount = Integer.parseInt(field2.getText());
|
39
|
60
|
cashMachine.deposit(amount);
|
40
|
61
|
|
41
|
62
|
areaInfo.setText(cashMachine.toString());
|
|
@@ -43,36 +64,59 @@ public class CashMachineApp extends Application {
|
43
|
64
|
|
44
|
65
|
Button btnWithdraw = new Button("Withdraw");
|
45
|
66
|
btnWithdraw.setOnAction(e -> {
|
46
|
|
- int amount = Integer.parseInt(field.getText());
|
|
67
|
+ int amount = Integer.parseInt(field2.getText());
|
47
|
68
|
cashMachine.withdraw(amount);
|
48
|
69
|
|
49
|
70
|
areaInfo.setText(cashMachine.toString());
|
50
|
71
|
});
|
51
|
72
|
|
52
|
|
- Button btnExit = new Button("Exit");
|
|
73
|
+ Button btnExit = new Button("LogOut");
|
53
|
74
|
btnExit.setOnAction(e -> {
|
54
|
75
|
cashMachine.exit();
|
55
|
|
-
|
56
|
|
- areaInfo.setText(cashMachine.toString());
|
|
76
|
+ field.clear();
|
|
77
|
+ field2.clear();
|
|
78
|
+ areaInfo.clear();
|
57
|
79
|
});
|
58
|
80
|
|
59
|
81
|
FlowPane flowpane = new FlowPane();
|
60
|
82
|
|
61
|
83
|
flowpane.getChildren().add(btnSubmit);
|
62
|
|
- flowpane.getChildren().add(btnDeposit);
|
63
|
|
- flowpane.getChildren().add(btnWithdraw);
|
64
|
|
- flowpane.getChildren().add(btnExit);
|
65
|
|
- vbox.getChildren().addAll(field, flowpane, areaInfo);
|
|
84
|
+ /*
|
|
85
|
+ flowpane.getChildren().add(btnNewAccount);
|
|
86
|
+ flowpane.getChildren().add(btnForgotAccountNumber);
|
|
87
|
+ */
|
|
88
|
+
|
|
89
|
+ FlowPane flowpane2 = new FlowPane();
|
|
90
|
+
|
|
91
|
+ flowpane2.getChildren().add(btnDeposit);
|
|
92
|
+ flowpane2.getChildren().add(btnWithdraw);
|
|
93
|
+ flowpane2.getChildren().add(btnExit);
|
|
94
|
+ Label fieldLabel2 = new Label("Amount:");
|
|
95
|
+ Label accountInfo2 = new Label("Account Info:");
|
|
96
|
+
|
|
97
|
+ field.setStyle("-fx-background-color: beige;");
|
|
98
|
+ field2.setStyle("-fx-background-color: beige;");
|
|
99
|
+ Label fieldLabel = new Label("Account Number:");
|
|
100
|
+ vbox.getChildren().addAll(fieldLabel, field, flowpane, fieldLabel2, field2, flowpane2, accountInfo2, areaInfo);
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
66
|
104
|
return vbox;
|
|
105
|
+
|
|
106
|
+
|
67
|
107
|
}
|
68
|
108
|
|
69
|
109
|
@Override
|
70
|
110
|
public void start(Stage stage) throws Exception {
|
|
111
|
+ stage.setTitle("ZipCloud Bank");
|
71
|
112
|
stage.setScene(new Scene(createContent()));
|
72
|
113
|
stage.show();
|
|
114
|
+
|
73
|
115
|
}
|
74
|
116
|
|
75
|
117
|
public static void main(String[] args) {
|
76
|
118
|
launch(args);
|
77
|
119
|
}
|
|
120
|
+
|
|
121
|
+
|
78
|
122
|
}
|