From 2fe71cbe7e8ffe709a6dac85b66e45937534b3ce Mon Sep 17 00:00:00 2001 From: Kevin Pfannenstiel Date: Mon, 30 Jan 2023 10:13:37 +0100 Subject: [PATCH] =?UTF-8?q?Dateien=20abge=C3=A4ndert=20und=20m=C3=B6glich?= =?UTF-8?q?=20gemacht,=20dass=20die=20scenes=20wechseln=20wenn=20mann=20au?= =?UTF-8?q?f=20den=20button=20dr=C3=BCckt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/vpr_javafx/HelloApplication.java | 5 +- .../example/vpr_javafx/HelloController.java | 48 ++-- .../java/com/example/vpr_javafx/Menu.java | 12 - .../java/com/example/vpr_javafx/Order.java | 5 - .../example/vpr_javafx/MenuSelect-view.fxml | 90 +++++++ .../example/vpr_javafx/Registration-view.fxml | 14 ++ .../com/example/vpr_javafx/hello-view.fxml | 233 +++++------------- .../example/vpr_javafx/HelloApplication.class | Bin 1525 -> 1461 bytes .../example/vpr_javafx/HelloController.class | Bin 4992 -> 5397 bytes .../classes/com/example/vpr_javafx/Menu.class | Bin 1828 -> 1210 bytes .../example/vpr_javafx/MenuSelect-view.fxml | 90 +++++++ .../com/example/vpr_javafx/Order.class | Bin 1196 -> 577 bytes .../example/vpr_javafx/Registration-view.fxml | 14 ++ .../com/example/vpr_javafx/hello-view.fxml | 233 +++++------------- 14 files changed, 336 insertions(+), 408 deletions(-) create mode 100644 src/main/resources/com/example/vpr_javafx/MenuSelect-view.fxml create mode 100644 src/main/resources/com/example/vpr_javafx/Registration-view.fxml create mode 100644 target/classes/com/example/vpr_javafx/MenuSelect-view.fxml create mode 100644 target/classes/com/example/vpr_javafx/Registration-view.fxml diff --git a/src/main/java/com/example/vpr_javafx/HelloApplication.java b/src/main/java/com/example/vpr_javafx/HelloApplication.java index 2320a1e..5be1453 100644 --- a/src/main/java/com/example/vpr_javafx/HelloApplication.java +++ b/src/main/java/com/example/vpr_javafx/HelloApplication.java @@ -11,13 +11,12 @@ public class HelloApplication extends Application { @Override public void start(Stage stage) throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); - Scene scene = new Scene(fxmlLoader.load(),1000, 800); - stage.setTitle("Mittagsbestellung"); + Scene scene = new Scene(fxmlLoader.load()); + stage.setTitle("Essen Bestellen"); stage.setScene(scene); stage.show(); HelloController controller = fxmlLoader.getController(); controller.FillLabels(); - controller.writeAllergene(); } public static void main(String[] args) { diff --git a/src/main/java/com/example/vpr_javafx/HelloController.java b/src/main/java/com/example/vpr_javafx/HelloController.java index 4b6760f..88da7c6 100644 --- a/src/main/java/com/example/vpr_javafx/HelloController.java +++ b/src/main/java/com/example/vpr_javafx/HelloController.java @@ -1,10 +1,13 @@ package com.example.vpr_javafx; +import javafx.event.ActionEvent; import javafx.fxml.FXML; -import javafx.scene.control.Alert; -import javafx.scene.control.Label; -import javafx.scene.control.PasswordField; -import javafx.scene.control.TextField; +import javafx.fxml.FXMLLoader; +import javafx.scene.Node; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.stage.Stage; import java.io.IOException; import java.nio.file.Files; @@ -59,11 +62,11 @@ public class HelloController { @FXML private PasswordField pfPassword; - @FXML - private Label allergene; + private Stage stage; + private Scene scene; @FXML - protected void OnSignInButton() + protected void OnSignInButton(ActionEvent event) throws IOException { LoginDatei file = new LoginDatei("user.txt"); HashMap users = file.readFile(); @@ -73,8 +76,11 @@ public class HelloController { { if (users.containsValue(pfPassword.getText())) { - alert.setContentText("Erfolgreich eingelogt"); - alert.show(); + Parent root = FXMLLoader.load(getClass().getResource("MenuSelect-view.fxml")); + stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + scene = new Scene(root); + stage.setScene(scene); + stage.show(); } else { @@ -89,6 +95,7 @@ public class HelloController { } } + @FXML protected void FillLabels() { try { @@ -192,27 +199,4 @@ public class HelloController { } } - /** - * writeAllergene() is a method to format and set allergene - * @author Madeleine Vigier - */ - @FXML - protected void writeAllergene() { - allergene.setText("a: Eier; b: Soja,\n" - + "c: Milch; d: Erdnüsse;\n" - + "e: Weichtiere; f: Krebstiere;\n" - + "g: Getreide; h: Senf; i: Sesam;\n" - + "j: Schwefeldioxid und Sulfit;\n" - + "k: Nüsse; l: Sellerie;\n" - + "m: Fische; n: Lupinen\n\n" - + "1: Nitrit-Pökelsalz\n" - + "2:Phosphat\n" - + "3: Nitrat\n" - + "4: Antioxidationsmittel\n" - + "5: Farbstoff\n" - + "6: Geschmacksverstärker;\n" - + "7: Süßungsmittel;\n" - + "8: Konservierungsstoff"); - } - } \ No newline at end of file diff --git a/src/main/java/com/example/vpr_javafx/Menu.java b/src/main/java/com/example/vpr_javafx/Menu.java index 5fe5db1..aa6edf2 100644 --- a/src/main/java/com/example/vpr_javafx/Menu.java +++ b/src/main/java/com/example/vpr_javafx/Menu.java @@ -15,7 +15,6 @@ public class Menu { String type; List ingredients; - /** * constructor * @@ -58,16 +57,5 @@ public class Menu { } } - - /** - * The method toString() returns a String formated to save in a File - * - * @return a String with dish, sideDish, list of ingredients and the typ of the menu - * @author Madeleine Vigier, Felix Wöstemeyer - */ - @Override - public String toString() { - return date+";"+dish+";"+sideDish+";"+type+";"+ingredients; - } } diff --git a/src/main/java/com/example/vpr_javafx/Order.java b/src/main/java/com/example/vpr_javafx/Order.java index 1775a2e..9393797 100644 --- a/src/main/java/com/example/vpr_javafx/Order.java +++ b/src/main/java/com/example/vpr_javafx/Order.java @@ -20,9 +20,4 @@ public class Order { this.mealtype = mealtype; this.desserttype = desserttype; } - - @Override - public String toString(){ - return date+";"+user+";"+mealtype+";"+desserttype; - } } diff --git a/src/main/resources/com/example/vpr_javafx/MenuSelect-view.fxml b/src/main/resources/com/example/vpr_javafx/MenuSelect-view.fxml new file mode 100644 index 0000000..3f9935d --- /dev/null +++ b/src/main/resources/com/example/vpr_javafx/MenuSelect-view.fxml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/example/vpr_javafx/Registration-view.fxml b/src/main/resources/com/example/vpr_javafx/Registration-view.fxml new file mode 100644 index 0000000..2b1ebef --- /dev/null +++ b/src/main/resources/com/example/vpr_javafx/Registration-view.fxml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/src/main/resources/com/example/vpr_javafx/hello-view.fxml b/src/main/resources/com/example/vpr_javafx/hello-view.fxml index e636758..9a852ab 100644 --- a/src/main/resources/com/example/vpr_javafx/hello-view.fxml +++ b/src/main/resources/com/example/vpr_javafx/hello-view.fxml @@ -1,217 +1,94 @@ - - - - - - - - - - - + + + + + - -