From 217ae4b1a3c45c55ab307a49ce76638ad117dcf7 Mon Sep 17 00:00:00 2001
From: Jan <janschubert93@web.de>
Date: Tue, 3 Dec 2019 08:40:50 +0100
Subject: [PATCH] =?UTF-8?q?2=20Szenen=20f=C3=BCr=20Kenngruppe=20und=20Gui.?=
 =?UTF-8?q?=20Stand=203.12.=2008:40?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/main/java/projekt/enigma/App.java | 146 ++++++++++++++++++--------
 1 file changed, 103 insertions(+), 43 deletions(-)

diff --git a/src/main/java/projekt/enigma/App.java b/src/main/java/projekt/enigma/App.java
index f53dcdf..64ffd20 100644
--- a/src/main/java/projekt/enigma/App.java
+++ b/src/main/java/projekt/enigma/App.java
@@ -4,7 +4,12 @@ import javafx.application.Application;
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Parent;
 import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.VBox;
 import javafx.stage.Stage;
+import projekt.enigma.model.Codierer;
 
 import java.io.IOException;
 
@@ -13,54 +18,109 @@ import java.io.IOException;
  */
 public class App extends Application {
 
-	/**
-	 * TODO Dokumentieren
-	 */
-	private static Scene scene;
-
-	/**
-	 * TODO Dokumentieren
-	 *
-	 * @param fxml
-	 * @throws IOException
-	 */
-	static void setRoot(String fxml) throws IOException {
-		scene.setRoot(loadFXML(fxml));
-	}
+    Scene sce1, sce2;
+
+    @Override
+    public void start(Stage primaryStage) throws IOException {
+
+        Codierer cod = new Codierer();
+
+        primaryStage.setTitle("Kenngruppenabfrage");
+
+//Scene 1
+        Label label1= new Label("Bitte Kenngruppe eingeben!");
+        label1.setTranslateX(55);
+        Label l1=new Label("");
+        Label l2 = new Label("");
+        TextField tfield=new TextField();
+        Button button1= new Button("Kenngruppe setzen!");
+
+        VBox layout1 = new VBox();
+        // kc.btnGui(primaryStage, sce2);
+        button1.setOnAction(e -> {
+            if (tfield.getText().length() < 9) {
+                for (char c : tfield.getText().toCharArray()) {
+                    if (c == 'a' || c == 'b' || c == 'c' || c == 'd' || c == 'e' || c == 'f' || c == 'g' || c == 'h' || c == 'i' || c == 'j' || c == 'k' || c == 'l' || c == 'm' || c == 'n' || c == 'o' || c == 'p' || c == 'q' || c == 'r' || c == 's' || c == 't' || c == 'u' || c == 'v' || c == 'w' || c == 'x' || c == 'y' || c == 'z' || c == 'A' || c == 'B' || c == 'C' || c == 'D' || c == 'E' || c == 'F' || c == 'G' || c == 'H' || c == 'I' || c == 'J' || c == 'K' || c == 'L' || c == 'M' || c == 'N' || c == 'O' || c == 'P' || c == 'Q' || c == 'R' || c == 'S' || c == 'T' || c == 'U' || c == 'V' || c == 'W' || c == 'X' || c == 'Y' || c == 'Z') {
+                        cod.setKenngruppe(tfield.getText());
+                        primaryStage.setScene(sce2);
+                    }
+                }
+            }else{
+                tfield.setStyle("-fx-background-color:#FF0000");
+                tfield.setText("Fehlerhafte Kenngruppe!");
+            }
+        });
+        layout1.getChildren().addAll(label1,l1,tfield,l2,button1);
+
+        //sce1= new Scene(loadFXML("kenngruppe"), 300, 250);
 
-	/**
-	 * TODO Dokumentieren
-	 *
-	 * @param fxml
-	 * @return
-	 * @throws IOException
-	 */
-	private static Parent loadFXML(String fxml) throws IOException {
+        sce1=new Scene(layout1,234,137);
+
+        sce2 = new Scene(loadFXML("gui"), 962, 677);
+
+        primaryStage.setScene(sce1);
+        primaryStage.show();
+    }
+
+    	private static Parent loadFXML(String fxml) throws IOException {
 		FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
 		return fxmlLoader.load();
 	}
 
-	/**
-	 * TODO Dokumentieren
-	 *
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		Application.launch();
-	}
 
-	/**
-	 * TODO Dokumentieren
-	 *
-	 * @param stage
-	 * @throws IOException
-	 */
-	@Override
-	public void start(Stage stage) throws IOException {
-		scene = new Scene(loadFXML("kenngruppe"));
-		stage.setScene(scene);
-		stage.setResizable(true);
-		stage.show();
-	}
+    public static void main(String[] args) {
+        launch(args);
+    }
+
+
+//	/**
+//	 * TODO Dokumentieren
+//	 */
+//	private static Scene scene;
+//	/**
+//	 * TODO Dokumentieren
+//	 *
+//	 * @param fxml
+//	 * @throws IOException
+//	 */
+//	static void setRoot(String fxml) throws IOException {
+//		scene.setRoot(loadFXML(fxml));
+//
+//	}
+//
+//	/**
+//	 * TODO Dokumentieren
+//	 *
+//	 * @param fxml
+//	 * @return
+//	 * @throws IOException
+//	 */
+//	private static Parent loadFXML(String fxml) throws IOException {
+//		FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
+//		return fxmlLoader.load();
+//	}
+//
+//	/**
+//	 * TODO Dokumentieren
+//	 *
+//	 * @param args
+//	 */
+//	public static void main(String[] args) {
+//		Application.launch();
+//	}
+//
+//	/**
+//	 * TODO Dokumentieren
+//	 *
+//	 * @param stage
+//	 * @throws IOException
+//	 */
+//	@Override
+//	public void start(Stage stage) throws IOException {
+//		scene = new Scene(loadFXML("kenngruppe"));
+//		stage.setScene(scene);
+//		stage.setResizable(true);
+//		stage.show();
+//	}
 
 }
-- 
GitLab