diff --git a/src/main/java/projekt/enigma/App.java b/src/main/java/projekt/enigma/App.java deleted file mode 100644 index 84a5b30c3952ad39df5e33d0760e222974c707d8..0000000000000000000000000000000000000000 --- a/src/main/java/projekt/enigma/App.java +++ /dev/null @@ -1,66 +0,0 @@ -package projekt.enigma; - -import projekt.enigma.model.Codierer; -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.stage.Stage; -import java.io.IOException; - -/** - * JavaFX App - */ -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)); - } - - /** - * 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("gui")); - stage.setScene(scene); - stage.setResizable(true); - stage.show(); - } - -} diff --git a/src/main/java/projekt/enigma/KenngruppeController.java b/src/main/java/projekt/enigma/KenngruppeController.java index 3371b0f647ea6f27a72082ae0f18a44b79faf489..79ed1a081019f57c7970c721171b445873fa48e7 100644 --- a/src/main/java/projekt/enigma/KenngruppeController.java +++ b/src/main/java/projekt/enigma/KenngruppeController.java @@ -1,12 +1,56 @@ package projekt.enigma; +import java.awt.event.ActionEvent; import java.io.IOException; + import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TextField; +import javafx.stage.Stage; +import projekt.enigma.model.Codierer; + public class KenngruppeController { + private Codierer cod = new Codierer(); + + private Stage stage; + @FXML - private void switchToPrimary() throws IOException { - App.setRoot("gui"); + private TextField tfKenngruppe; + + @FXML + private Button btnswitch; + +// @FXML +// private void switchToPrimary() throws IOException { +// if (tfKenngruppe.getText().length() <= 8) { +// for (char c : tfKenngruppe.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') { +// cod.setKenngruppe(tfKenngruppe.getText()); +// +// App.setRoot("gui"); +// } +// } +// } else { +// tfKenngruppe.setStyle("-fx-background-color:#FF0000"); +// tfKenngruppe.setText("Fehlerhafte Kenngruppe!"); +// } +// } + private Scene secondScene; + + public void setSecondScene(Scene scene){ + secondScene=scene; + } + + @FXML + private void switchToPrimary(ActionEvent ae) throws IOException { + Stage primaryStage = (Stage)((Node)ae.getSource()).getScene().getWindow(); + primaryStage.setScene(secondScene); + } + + + } -} \ No newline at end of file diff --git a/src/main/resources/projekt/enigma/gui.fxml b/src/main/resources/projekt/enigma/gui.fxml index 62178e6b6b32b6e84bb4d38f9930314eec347eca..6e28fe1c37b7a09e80b5a9367fbfd409598af45b 100644 --- a/src/main/resources/projekt/enigma/gui.fxml +++ b/src/main/resources/projekt/enigma/gui.fxml @@ -193,7 +193,7 @@ <Insets left="10.0" right="10.0" /> </GridPane.margin> </TextField> - <Button fx:id="btnA" minHeight="35.0" mnemonicParsing="false" onAction="#gedrueckteTaste" prefHeight="43.0" prefWidth="45.0" style="-fx-background-radius: 100; -fx-background-color: #0d0d0d;" text="A" textFill="#fffdfd" GridPane.columnIndex="2" GridPane.rowIndex="5"> + <Button fx:id="btnA" minHeight="35.0" mnemonicParsing="false" onMousePressed="#tasteRunter" onMouseReleased="#tasteRauf" prefHeight="43.0" prefWidth="45.0" style="-fx-background-radius: 100; -fx-background-color: #0d0d0d;" text="A" textFill="#fffdfd" GridPane.columnIndex="2" GridPane.rowIndex="5"> <font> <Font name="System Bold" size="18.0" /> </font> diff --git a/src/main/resources/projekt/enigma/kenngruppe.fxml b/src/main/resources/projekt/enigma/kenngruppe.fxml index 2cedf3644a5b65ea0c8f53751137ac55e051acd3..8beeef733c27bdb39769eb2c544cbf3696c55a9a 100644 --- a/src/main/resources/projekt/enigma/kenngruppe.fxml +++ b/src/main/resources/projekt/enigma/kenngruppe.fxml @@ -2,21 +2,20 @@ <?import javafx.scene.control.Button?> <?import javafx.scene.control.Label?> +<?import javafx.scene.control.TextField?> <?import javafx.scene.layout.AnchorPane?> -<?import javafx.scene.layout.HBox?> -<?import javafx.scene.shape.Circle?> +<?import javafx.scene.layout.VBox?> -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="411.0" prefWidth="512.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="projekt.enigma.KenngruppeController"> +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="137.0" prefWidth="234.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="projekt.enigma.KenngruppeController"> <children> - <Label layoutX="81.0" layoutY="29.0" text="Bitte Kenngruppe eingeben!" AnchorPane.leftAnchor="81.0" AnchorPane.rightAnchor="70.0" AnchorPane.topAnchor="29.0" /> - <HBox layoutX="107.0" layoutY="141.0" prefHeight="26.0" prefWidth="276.0" AnchorPane.leftAnchor="107.0" AnchorPane.rightAnchor="129.0" AnchorPane.topAnchor="141.0"> + <VBox layoutX="13.0" layoutY="20.0" prefHeight="107.0" prefWidth="209.0" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="13.0" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="20.0"> <children> - <Button fx:id="secondaryButton" onAction="#switchToPrimary" prefHeight="25.0" prefWidth="142.0" text="Kenngruppe bestätigen!" /> - <Label prefHeight="17.0" prefWidth="159.0" text="Label" /> - <Button mnemonicParsing="false" prefHeight="25.0" prefWidth="150.0" text="Button" /> + <Label alignment="CENTER" contentDisplay="CENTER" prefHeight="17.0" prefWidth="208.0" text="Bitte Kenngruppe eingeben!" /> + <Label prefHeight="62.0" prefWidth="209.0" /> + <TextField fx:id="tfKenngruppe" /> + <Label prefHeight="39.0" prefWidth="209.0" /> + <Button fx:id="btnswitch" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" onAction="#switchToPrimary" prefHeight="25.0" prefWidth="212.0" text="Kenngruppe setzen!" /> </children> - </HBox> - <Circle fill="DODGERBLUE" layoutX="226.0" layoutY="267.0" radius="100.0" stroke="BLACK" strokeType="INSIDE" AnchorPane.leftAnchor="126.0" AnchorPane.rightAnchor="186.0" AnchorPane.topAnchor="167.0" /> - <Button fx:id="secondaryButton" layoutX="40.0" layoutY="85.0" onAction="#switchToPrimary" prefHeight="25.0" prefWidth="241.0" text="Kenngruppe bestätigen!" /> + </VBox> </children> </AnchorPane>