|
@@ -1,27 +1,36 @@
|
1
|
1
|
package rocks.zipcode.atm;
|
2
|
2
|
|
3
|
|
-import javafx.scene.control.Label;
|
|
3
|
+import javafx.scene.control.*;
|
|
4
|
+import javafx.scene.layout.HBox;
|
4
|
5
|
import javafx.stage.StageStyle;
|
5
|
6
|
import rocks.zipcode.atm.bank.Bank;
|
6
|
7
|
import javafx.application.Application;
|
7
|
8
|
import javafx.scene.Parent;
|
8
|
9
|
import javafx.scene.Scene;
|
9
|
|
-import javafx.scene.control.Button;
|
10
|
|
-import javafx.scene.control.TextArea;
|
11
|
|
-import javafx.scene.control.TextField;
|
12
|
10
|
import javafx.scene.layout.VBox;
|
13
|
11
|
import javafx.stage.Stage;
|
14
|
12
|
import javafx.scene.layout.FlowPane;
|
15
|
13
|
|
|
14
|
+import java.util.HashMap;
|
|
15
|
+
|
16
|
16
|
/**
|
17
|
17
|
* @author ZipCodeWilmington
|
18
|
18
|
*/
|
19
|
19
|
public class CashMachineApp extends Application {
|
20
|
20
|
|
|
21
|
+
|
|
22
|
+/*
|
|
23
|
+ HashMap<String, String> estados = EstadosBrasil.getEstados();
|
|
24
|
+for(Entry<String, String> e : estados.entrySet()){
|
|
25
|
+ Object obj = comboEstado.addItem();
|
|
26
|
+ comboEstado.setItemCaption(e.getKey(), e.getValue());
|
|
27
|
+ comboEstado.setValue(obj);
|
|
28
|
+ }*/
|
|
29
|
+
|
21
|
30
|
private TextField field = new TextField();
|
22
|
31
|
private TextField field2 = new TextField();
|
23
|
32
|
private CashMachine cashMachine = new CashMachine(new Bank());
|
24
|
|
-
|
|
33
|
+ private ComboBox accountNumbers = new ComboBox(cashMachine.getIdList());
|
25
|
34
|
|
26
|
35
|
private Parent createContent() {
|
27
|
36
|
VBox vbox = new VBox(10);
|
|
@@ -60,7 +69,7 @@ public class CashMachineApp extends Application {
|
60
|
69
|
areaInfo.setText(cashMachine.toString());
|
61
|
70
|
});
|
62
|
71
|
|
63
|
|
- Button btnExit = new Button("LogOut");
|
|
72
|
+ Button btnExit = new Button("Log Out");
|
64
|
73
|
btnExit.setOnAction(e -> {
|
65
|
74
|
cashMachine.exit();
|
66
|
75
|
field.clear();
|
|
@@ -72,7 +81,7 @@ public class CashMachineApp extends Application {
|
72
|
81
|
|
73
|
82
|
Button btnSubmit = new Button("Enter");
|
74
|
83
|
btnSubmit.setOnAction(e -> {
|
75
|
|
- int id = Integer.parseInt(field.getText());
|
|
84
|
+ int id = Integer.parseInt(accountNumbers.getValue().toString());
|
76
|
85
|
cashMachine.login(id);
|
77
|
86
|
|
78
|
87
|
areaInfo.setText(cashMachine.toString());
|
|
@@ -96,7 +105,7 @@ public class CashMachineApp extends Application {
|
96
|
105
|
field.setStyle("-fx-background-color: beige;");
|
97
|
106
|
field2.setStyle("-fx-background-color: beige;");
|
98
|
107
|
Label fieldLabel = new Label("Account Number:");
|
99
|
|
- vbox.getChildren().addAll(fieldLabel, field, flowpane, fieldLabel2, field2, flowpane2, accountInfo2, areaInfo);
|
|
108
|
+ vbox.getChildren().addAll(fieldLabel, accountNumbers, flowpane, fieldLabel2, field2, flowpane2, accountInfo2, areaInfo);
|
100
|
109
|
|
101
|
110
|
|
102
|
111
|
|
|
@@ -106,15 +115,17 @@ public class CashMachineApp extends Application {
|
106
|
115
|
}
|
107
|
116
|
|
108
|
117
|
@Override
|
109
|
|
- public void start(Stage stage) throws Exception {
|
110
|
|
- stage.setTitle("ZipCloud Bank");
|
111
|
|
- stage.setScene(new Scene(createContent()));
|
112
|
|
- stage.show();
|
|
118
|
+ public void start(Stage primarystage) throws Exception {
|
|
119
|
+ primarystage.setTitle("ZipCloud Bank");
|
|
120
|
+ primarystage.setScene(new Scene(createContent()));
|
|
121
|
+ primarystage.show();
|
113
|
122
|
|
114
|
123
|
}
|
115
|
124
|
|
116
|
125
|
public static void main(String[] args) {
|
|
126
|
+
|
117
|
127
|
launch(args);
|
|
128
|
+
|
118
|
129
|
}
|
119
|
130
|
|
120
|
131
|
|