Selaa lähdekoodia

Before I go too far trying Scene Builder

NedRedmond 6 vuotta sitten
vanhempi
commit
67c716637c

+ 1
- 3
src/main/java/rocks/zipcode/atm/ActionResult.java Näytä tiedosto

@@ -20,9 +20,7 @@ public class ActionResult<T> {
20 20
         return data;
21 21
     }
22 22
 
23
-    public String getErrorMessage() {
24
-        return errorMessage;
25
-    }
23
+    public String getErrorMessage() { return errorMessage; }
26 24
 
27 25
     public boolean isSuccess() {
28 26
         return data != null;

+ 2
- 2
src/main/java/rocks/zipcode/atm/CashMachine.java Näytä tiedosto

@@ -47,7 +47,7 @@ public class CashMachine {
47 47
         }
48 48
     }
49 49
 
50
-    public void exit() {
50
+    public void logOut() {
51 51
         if (accountData != null) {
52 52
             accountData = null;
53 53
         }
@@ -58,7 +58,7 @@ public class CashMachine {
58 58
         return accountData != null ? accountData.toString() : "Try account 1000 or 2000 and click submit.";
59 59
     }
60 60
 
61
-    private <T> void tryCall(Supplier<ActionResult<T> > action, Consumer<T> postAction) {
61
+    public <T> void tryCall(Supplier<ActionResult<T> > action, Consumer<T> postAction) {
62 62
         try {
63 63
             ActionResult<T> result = action.get();
64 64
             if (result.isSuccess()) {

+ 2
- 2
src/main/java/rocks/zipcode/atm/CashMachineApp.java Näytä tiedosto

@@ -49,9 +49,9 @@ public class CashMachineApp extends Application {
49 49
             areaInfo.setText(cashMachine.toString());
50 50
         });
51 51
 
52
-        Button btnExit = new Button("Exit");
52
+        Button btnExit = new Button("Log Out");
53 53
         btnExit.setOnAction(e -> {
54
-            cashMachine.exit();
54
+            cashMachine.logOut();
55 55
 
56 56
             areaInfo.setText(cashMachine.toString());
57 57
         });

+ 14
- 0
src/main/java/rocks/zipcode/atm/CashMachineSkin.fxml Näytä tiedosto

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+
3
+<?import java.lang.*?>
4
+<?import java.util.*?>
5
+<?import javafx.scene.*?>
6
+<?import javafx.scene.control.*?>
7
+<?import javafx.scene.layout.*?>
8
+
9
+<AnchorPane xmlns="http://javafx.com/javafx"
10
+            xmlns:fx="http://javafx.com/fxml"
11
+            fx:controller="$CONTROLLER_NAME$"
12
+            prefHeight="400.0" prefWidth="600.0">
13
+
14
+</AnchorPane>