|
@@ -1,12 +1,8 @@
|
1
|
1
|
package rocks.zipcode.atm;
|
2
|
2
|
|
3
|
|
-import javafx.event.ActionEvent;
|
4
|
|
-import javafx.event.EventHandler;
|
5
|
|
-import javafx.geometry.Insets;
|
6
|
|
-import javafx.geometry.Pos;
|
7
|
|
-import javafx.scene.control.Label;
|
8
|
|
-import javafx.scene.layout.GridPane;
|
9
|
|
-import javafx.scene.layout.StackPane;
|
|
3
|
+import com.jfoenix.controls.JFXButton;
|
|
4
|
+import javafx.fxml.FXML;
|
|
5
|
+import javafx.fxml.FXMLLoader;
|
10
|
6
|
import rocks.zipcode.atm.bank.Bank;
|
11
|
7
|
import javafx.application.Application;
|
12
|
8
|
import javafx.scene.Parent;
|
|
@@ -18,89 +14,91 @@ import javafx.scene.layout.VBox;
|
18
|
14
|
import javafx.stage.Stage;
|
19
|
15
|
import javafx.scene.layout.FlowPane;
|
20
|
16
|
|
|
17
|
+import java.io.IOException;
|
|
18
|
+
|
21
|
19
|
/**
|
22
|
20
|
* @author ZipCodeWilmington
|
23
|
21
|
*/
|
24
|
22
|
public class CashMachineApp extends Application {
|
25
|
|
- private Stage window;
|
26
|
|
- Scene mainContent, loginScene;
|
27
|
|
- private TextField field = new TextField();
|
28
|
|
- private CashMachine cashMachine = new CashMachine(new Bank());
|
29
|
23
|
|
30
|
24
|
@Override
|
31
|
25
|
public void start(Stage stage) throws Exception {
|
32
|
|
- window = stage;
|
33
|
|
- window.setTitle("Zip Cloud Bank");
|
34
|
|
-
|
35
|
|
-
|
36
|
|
- //Log In Layout
|
37
|
|
- Label loginLabel = new Label("Welcome to Zip Cloud Bank!\nPlease log in.");
|
38
|
|
- Button btnLogIn = new Button("Log In");
|
39
|
|
- btnLogIn.setStyle("-fx-font-size: 15pt");
|
40
|
|
- btnLogIn.setOnAction(e -> {
|
41
|
|
- mainContent = new Scene(mainContent());
|
42
|
|
- window.setScene(mainContent);
|
43
|
|
- });
|
44
|
|
-
|
45
|
|
- GridPane loginLayout = new GridPane();
|
46
|
|
- loginLayout.setHgap(12);
|
47
|
|
- loginLayout.setVgap(12);
|
48
|
|
- loginLayout.setAlignment(Pos.CENTER);
|
49
|
|
- loginLayout.getChildren().addAll(loginLabel, field, btnLogIn);
|
50
|
|
-
|
51
|
|
- loginScene = new Scene(loginLayout,600, 600);
|
52
|
|
- window.setScene(loginScene);
|
53
|
|
-
|
54
|
|
-
|
55
|
|
- window.show();
|
|
26
|
+ FXMLLoader loader = new FXMLLoader();
|
|
27
|
+
|
|
28
|
+ stage.setTitle("Zip Cloud Bank");
|
|
29
|
+
|
|
30
|
+ // Is this cheating?
|
|
31
|
+ Parent start = loader.load(getClass().getResource("/LoginScreen.fxml"));
|
|
32
|
+ Scene content = new Scene(start);
|
|
33
|
+ stage.setScene(content);
|
|
34
|
+ stage.show();
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+// //Log In Layout
|
|
38
|
+// Label loginLabel = new Label("Welcome to Zip Cloud Bank!\nPlease log in.");
|
|
39
|
+// Button btnLogIn = new Button("Log In");
|
|
40
|
+// btnLogIn.setStyle("-fx-font-size: 15pt");
|
|
41
|
+// btnLogIn.setOnAction(e -> {
|
|
42
|
+// mainContent = new Scene(mainContent());
|
|
43
|
+// window.setScene(mainContent);
|
|
44
|
+// });
|
|
45
|
+//
|
|
46
|
+// GridPane loginLayout = new GridPane();
|
|
47
|
+// loginLayout.setHgap(12);
|
|
48
|
+// loginLayout.setVgap(12);
|
|
49
|
+// loginLayout.setAlignment(Pos.CENTER);
|
|
50
|
+// loginLayout.getChildren().addAll(loginLabel, field, btnLogIn);
|
|
51
|
+
|
|
52
|
+// loginScene = new Scene(loginLayout,600, 600);
|
|
53
|
+//
|
56
|
54
|
}
|
57
|
55
|
|
58
|
|
- private Parent mainContent() {
|
59
|
|
- VBox vbox = new VBox(10);
|
60
|
|
- vbox.setPrefSize(600, 600);
|
61
|
|
-
|
62
|
|
- TextArea areaInfo = new TextArea();
|
63
|
|
-
|
64
|
|
- Button btnSubmit = new Button("Set Account ID");
|
65
|
|
- btnSubmit.setOnAction(e -> {
|
66
|
|
- int id = Integer.parseInt(field.getText());
|
67
|
|
- cashMachine.login(id);
|
68
|
|
-
|
69
|
|
- areaInfo.setText(cashMachine.toString());
|
70
|
|
- });
|
71
|
|
-
|
72
|
|
- Button btnDeposit = new Button("Deposit");
|
73
|
|
- btnDeposit.setOnAction(e -> {
|
74
|
|
- int amount = Integer.parseInt(field.getText());
|
75
|
|
- cashMachine.deposit(amount);
|
76
|
|
-
|
77
|
|
- areaInfo.setText(cashMachine.toString());
|
78
|
|
- });
|
79
|
|
-
|
80
|
|
- Button btnWithdraw = new Button("Withdraw");
|
81
|
|
- btnWithdraw.setOnAction(e -> {
|
82
|
|
- int amount = Integer.parseInt(field.getText());
|
83
|
|
- cashMachine.withdraw(amount);
|
84
|
|
-
|
85
|
|
- areaInfo.setText(cashMachine.toString());
|
86
|
|
- });
|
87
|
|
-
|
88
|
|
- Button btnExit = new Button("Log Out");
|
89
|
|
- btnExit.setOnAction(e -> {
|
90
|
|
- cashMachine.logOut();
|
91
|
|
-
|
92
|
|
- areaInfo.setText(cashMachine.toString());
|
93
|
|
- });
|
94
|
|
-
|
95
|
|
- FlowPane flowpane = new FlowPane();
|
96
|
|
-
|
97
|
|
- flowpane.getChildren().add(btnSubmit);
|
98
|
|
- flowpane.getChildren().add(btnDeposit);
|
99
|
|
- flowpane.getChildren().add(btnWithdraw);
|
100
|
|
- flowpane.getChildren().add(btnExit);
|
101
|
|
- vbox.getChildren().addAll(field, flowpane, areaInfo);
|
102
|
|
- return vbox;
|
103
|
|
- }
|
|
56
|
+// private Parent mainContent() {
|
|
57
|
+// VBox vbox = new VBox(10);
|
|
58
|
+// vbox.setPrefSize(600, 600);
|
|
59
|
+//
|
|
60
|
+// TextArea areaInfo = new TextArea();
|
|
61
|
+//
|
|
62
|
+// Button btnSubmit = new Button("Set Account ID");
|
|
63
|
+// btnSubmit.setOnAction(e -> {
|
|
64
|
+// int id = Integer.parseInt(field.getText());
|
|
65
|
+// cashMachine.login(id);
|
|
66
|
+//
|
|
67
|
+// areaInfo.setText(cashMachine.toString());
|
|
68
|
+// });
|
|
69
|
+//
|
|
70
|
+// Button btnDeposit = new Button("Deposit");
|
|
71
|
+// btnDeposit.setOnAction(e -> {
|
|
72
|
+// int amount = Integer.parseInt(field.getText());
|
|
73
|
+// cashMachine.deposit(amount);
|
|
74
|
+//
|
|
75
|
+// areaInfo.setText(cashMachine.toString());
|
|
76
|
+// });
|
|
77
|
+//
|
|
78
|
+// Button btnWithdraw = new Button("Withdraw");
|
|
79
|
+// btnWithdraw.setOnAction(e -> {
|
|
80
|
+// int amount = Integer.parseInt(field.getText());
|
|
81
|
+// cashMachine.withdraw(amount);
|
|
82
|
+//
|
|
83
|
+// areaInfo.setText(cashMachine.toString());
|
|
84
|
+// });
|
|
85
|
+//
|
|
86
|
+// Button btnExit = new Button("Log Out");
|
|
87
|
+// btnExit.setOnAction(e -> {
|
|
88
|
+// cashMachine.logOut();
|
|
89
|
+//
|
|
90
|
+// areaInfo.setText(cashMachine.toString());
|
|
91
|
+// });
|
|
92
|
+//
|
|
93
|
+// FlowPane flowpane = new FlowPane();
|
|
94
|
+//
|
|
95
|
+// flowpane.getChildren().add(btnSubmit);
|
|
96
|
+// flowpane.getChildren().add(btnDeposit);
|
|
97
|
+// flowpane.getChildren().add(btnWithdraw);
|
|
98
|
+// flowpane.getChildren().add(btnExit);
|
|
99
|
+// vbox.getChildren().addAll(field, flowpane, areaInfo);
|
|
100
|
+// return vbox;
|
|
101
|
+// }
|
104
|
102
|
|
105
|
103
|
public static void main(String[] args) {
|
106
|
104
|
launch(args);
|