|
@@ -1,5 +1,9 @@
|
1
|
1
|
package rocks.zipcode.atm;
|
2
|
2
|
|
|
3
|
+import javafx.fxml.FXMLLoader;
|
|
4
|
+import javafx.scene.Group;
|
|
5
|
+import javafx.scene.image.ImageView;
|
|
6
|
+
|
3
|
7
|
import rocks.zipcode.atm.bank.Bank;
|
4
|
8
|
import javafx.application.Application;
|
5
|
9
|
import javafx.scene.Parent;
|
|
@@ -11,25 +15,54 @@ import javafx.scene.layout.VBox;
|
11
|
15
|
import javafx.stage.Stage;
|
12
|
16
|
import javafx.scene.layout.FlowPane;
|
13
|
17
|
|
|
18
|
+
|
|
19
|
+
|
14
|
20
|
/**
|
15
|
21
|
* @author ZipCodeWilmington
|
16
|
22
|
*/
|
17
|
23
|
public class CashMachineApp extends Application {
|
18
|
24
|
|
|
25
|
+
|
|
26
|
+
|
19
|
27
|
private TextField field = new TextField();
|
20
|
28
|
private CashMachine cashMachine = new CashMachine(new Bank());
|
21
|
29
|
|
22
|
30
|
private Parent createContent() {
|
23
|
31
|
VBox vbox = new VBox(10);
|
24
|
|
- vbox.setPrefSize(600, 600);
|
|
32
|
+ vbox.setPrefSize(800, 800);
|
25
|
33
|
|
26
|
34
|
TextArea areaInfo = new TextArea();
|
|
35
|
+ areaInfo.setStyle("-fx-background-color: aquamarine;");
|
|
36
|
+
|
|
37
|
+ /* Button btnCreateBasicAccount = new Button("Create Account");
|
|
38
|
+ btnCreateBasicAccount.setOnAction(e -> {
|
|
39
|
+ int id = Integer.parseInt(field.getText());
|
|
40
|
+ cashMachine.login(id);
|
|
41
|
+
|
|
42
|
+ areaInfo.setText(cashMachine.toString());
|
|
43
|
+ });*/
|
27
|
44
|
|
28
|
45
|
Button btnSubmit = new Button("Set Account ID");
|
29
|
46
|
btnSubmit.setOnAction(e -> {
|
30
|
47
|
int id = Integer.parseInt(field.getText());
|
31
|
48
|
cashMachine.login(id);
|
32
|
49
|
|
|
50
|
+ areaInfo.setText(cashMachine.getUser());
|
|
51
|
+ });
|
|
52
|
+
|
|
53
|
+ Button btnCheckBalance = new Button("Check Balance");
|
|
54
|
+ btnCheckBalance.setOnAction(e -> {
|
|
55
|
+ int amount = Integer.parseInt(field.getText());
|
|
56
|
+ cashMachine.checkBalance();
|
|
57
|
+
|
|
58
|
+ areaInfo.setText(cashMachine.getBalance());
|
|
59
|
+ });
|
|
60
|
+
|
|
61
|
+ Button btnAccountDetails = new Button("Account Information");
|
|
62
|
+ btnAccountDetails.setOnAction(e -> {
|
|
63
|
+ int amount = Integer.parseInt(field.getText());
|
|
64
|
+ cashMachine.toString();
|
|
65
|
+
|
33
|
66
|
areaInfo.setText(cashMachine.toString());
|
34
|
67
|
});
|
35
|
68
|
|
|
@@ -38,7 +71,7 @@ public class CashMachineApp extends Application {
|
38
|
71
|
int amount = Integer.parseInt(field.getText());
|
39
|
72
|
cashMachine.deposit(amount);
|
40
|
73
|
|
41
|
|
- areaInfo.setText(cashMachine.toString());
|
|
74
|
+ areaInfo.setText(cashMachine.getBalance());
|
42
|
75
|
});
|
43
|
76
|
|
44
|
77
|
Button btnWithdraw = new Button("Withdraw");
|
|
@@ -46,30 +79,54 @@ public class CashMachineApp extends Application {
|
46
|
79
|
int amount = Integer.parseInt(field.getText());
|
47
|
80
|
cashMachine.withdraw(amount);
|
48
|
81
|
|
49
|
|
- areaInfo.setText(cashMachine.toString());
|
|
82
|
+ areaInfo.setText(cashMachine.getBalance());
|
50
|
83
|
});
|
51
|
84
|
|
52
|
85
|
Button btnExit = new Button("Exit");
|
53
|
86
|
btnExit.setOnAction(e -> {
|
54
|
87
|
cashMachine.exit();
|
55
|
88
|
|
56
|
|
- areaInfo.setText(cashMachine.toString());
|
|
89
|
+ areaInfo.setText(cashMachine.goodBye());
|
57
|
90
|
});
|
58
|
91
|
|
59
|
92
|
FlowPane flowpane = new FlowPane();
|
60
|
93
|
|
61
|
94
|
flowpane.getChildren().add(btnSubmit);
|
|
95
|
+ flowpane.getChildren().add(btnCheckBalance);
|
62
|
96
|
flowpane.getChildren().add(btnDeposit);
|
63
|
97
|
flowpane.getChildren().add(btnWithdraw);
|
|
98
|
+ flowpane.getChildren().add(btnAccountDetails);
|
64
|
99
|
flowpane.getChildren().add(btnExit);
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+ //Image image = new Image("file:atm.jpg");
|
|
103
|
+ ImageView mv = new ImageView("file:atm.jpg");
|
|
104
|
+
|
|
105
|
+ Group root = new Group();
|
|
106
|
+ root.getChildren().addAll(mv);
|
|
107
|
+
|
|
108
|
+ vbox.setStyle("-fx-background-color: silver; -fx-padding: 20; -fx-font-size: 20;");
|
65
|
109
|
vbox.getChildren().addAll(field, flowpane, areaInfo);
|
66
|
110
|
return vbox;
|
67
|
111
|
}
|
68
|
112
|
|
69
|
113
|
@Override
|
70
|
114
|
public void start(Stage stage) throws Exception {
|
|
115
|
+
|
|
116
|
+ stage.setTitle("ZIPCLOUD BANK");
|
71
|
117
|
stage.setScene(new Scene(createContent()));
|
72
|
118
|
stage.show();
|
|
119
|
+
|
|
120
|
+ /*try {
|
|
121
|
+
|
|
122
|
+ Parent root = FXMLLoader.load(getClass().getResource("/Users/thulasipuppala/Labs/CashMachine/src/main/java/rocks/zipcode/atm/Login.fxml"));
|
|
123
|
+ Scene scene1 = new Scene(root, 600, 600);
|
|
124
|
+ stage.setScene(scene1);
|
|
125
|
+ stage.show();
|
|
126
|
+ }
|
|
127
|
+ catch (Exception e){
|
|
128
|
+ e.printStackTrace();
|
|
129
|
+ }*/
|
73
|
130
|
}
|
74
|
131
|
|
75
|
132
|
public static void main(String[] args) {
|