|
@@ -1,5 +1,6 @@
|
1
|
1
|
package rocks.zipcode.atm;
|
2
|
2
|
|
|
3
|
+import javafx.scene.layout.HBox;
|
3
|
4
|
import rocks.zipcode.atm.bank.Bank;
|
4
|
5
|
import javafx.application.Application;
|
5
|
6
|
import javafx.scene.Parent;
|
|
@@ -19,13 +20,15 @@ public class CashMachineApp extends Application {
|
19
|
20
|
private TextField field = new TextField();
|
20
|
21
|
private CashMachine cashMachine = new CashMachine(new Bank());
|
21
|
22
|
|
|
23
|
+
|
22
|
24
|
private Parent createContent() {
|
23
|
25
|
VBox vbox = new VBox(10);
|
24
|
|
- vbox.setPrefSize(600, 600);
|
|
26
|
+ vbox.setPrefSize(800, 600);
|
25
|
27
|
|
26
|
28
|
TextArea areaInfo = new TextArea();
|
27
|
29
|
|
28
|
|
- Button btnSubmit = new Button("Set Account ID");
|
|
30
|
+ Button btnSubmit = new Button("Account ID");
|
|
31
|
+ btnSubmit.setStyle("-fx-border-color: #0000ff; -fx-border-width: 5px;");
|
29
|
32
|
btnSubmit.setOnAction(e -> {
|
30
|
33
|
int id = Integer.parseInt(field.getText());
|
31
|
34
|
cashMachine.login(id);
|
|
@@ -34,6 +37,7 @@ public class CashMachineApp extends Application {
|
34
|
37
|
});
|
35
|
38
|
|
36
|
39
|
Button btnDeposit = new Button("Deposit");
|
|
40
|
+ btnDeposit.setStyle("-fx-border-color: #0000ff; -fx-border-width: 5px;");
|
37
|
41
|
btnDeposit.setOnAction(e -> {
|
38
|
42
|
int amount = Integer.parseInt(field.getText());
|
39
|
43
|
cashMachine.deposit(amount);
|
|
@@ -42,6 +46,7 @@ public class CashMachineApp extends Application {
|
42
|
46
|
});
|
43
|
47
|
|
44
|
48
|
Button btnWithdraw = new Button("Withdraw");
|
|
49
|
+ btnWithdraw.setStyle("-fx-border-color: #0000ff; -fx-border-width: 5px;");
|
45
|
50
|
btnWithdraw.setOnAction(e -> {
|
46
|
51
|
int amount = Integer.parseInt(field.getText());
|
47
|
52
|
cashMachine.withdraw(amount);
|
|
@@ -49,7 +54,17 @@ public class CashMachineApp extends Application {
|
49
|
54
|
areaInfo.setText(cashMachine.toString());
|
50
|
55
|
});
|
51
|
56
|
|
|
57
|
+ Button btnBalance = new Button("Balance");
|
|
58
|
+ btnBalance.setStyle("-fx-border-color: #0000ff; -fx-border-width: 5px;");
|
|
59
|
+ btnBalance.setOnAction(e -> {
|
|
60
|
+ int amount = Integer.parseInt(field.getText());
|
|
61
|
+ cashMachine.balance(amount);
|
|
62
|
+
|
|
63
|
+ areaInfo.setText(cashMachine.toString());
|
|
64
|
+ });
|
|
65
|
+
|
52
|
66
|
Button btnExit = new Button("Exit");
|
|
67
|
+ btnExit.setStyle("-fx-border-color: #0000ff; -fx-border-width: 5px;");
|
53
|
68
|
btnExit.setOnAction(e -> {
|
54
|
69
|
cashMachine.exit();
|
55
|
70
|
|
|
@@ -68,8 +83,11 @@ public class CashMachineApp extends Application {
|
68
|
83
|
|
69
|
84
|
@Override
|
70
|
85
|
public void start(Stage stage) throws Exception {
|
|
86
|
+ stage.setTitle("Welcome to ZipCloudBank");
|
|
87
|
+
|
71
|
88
|
stage.setScene(new Scene(createContent()));
|
72
|
89
|
stage.show();
|
|
90
|
+
|
73
|
91
|
}
|
74
|
92
|
|
75
|
93
|
public static void main(String[] args) {
|