Skip to content
Snippets Groups Projects
Commit 296616db authored by Dennis Eisold's avatar Dennis Eisold
Browse files

Merge branch 'master' into 'master'

1. GUI angepasst

See merge request !112
parents 3a9710fe 6bc48541
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,9 @@ package projekt.enigma; ...@@ -2,10 +2,9 @@ package projekt.enigma;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.*;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCode;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Stage; import javafx.stage.Stage;
...@@ -20,86 +19,80 @@ import java.io.IOException; ...@@ -20,86 +19,80 @@ import java.io.IOException;
*/ */
public class App extends Application { public class App extends Application {
private static String kenngruppe; private static GuiController gc;
private static GuiController gc; private static int debug;
private static int debug;
public static void main(String[] args) {
public static void main(String[] args) { debug = 1;
debug = 1; launch(args);
launch(args); }
}
public static int getDebug() {
public static int getDebug() { return debug;
return debug; }
}
@Override
@Override public void start(Stage primaryStage) throws IOException {
public void start(Stage primaryStage) throws IOException { primaryStage.setTitle("Enigma");
Label lblEingbae = new Label("Bitte Kenngruppe eingeben!");
primaryStage.setTitle("Kenngruppenabfrage"); TextField tfEingabe = new TextField();
Button btnKenngruppe = new Button("Kenngruppe setzen!");
Label label1 = new Label("Bitte Kenngruppe eingeben!"); VBox layout = new VBox();
label1.setTranslateX(55); layout.setSpacing(30);
Label l1 = new Label(""); layout.setPadding(new Insets(30, 30, 30, 30));
Label l2 = new Label(""); btnKenngruppe.setMaxWidth(Double.MAX_VALUE);
TextField tfield = new TextField();
Button button1 = new Button("Kenngruppe setzen!"); layout.getChildren().addAll(lblEingbae, tfEingabe, btnKenngruppe);
VBox layout1 = new VBox(); Scene sceKenngruppe = new Scene(layout);
layout1.getChildren().addAll(label1, l1, tfield, l2, button1); FXMLLoader guiLoader = new FXMLLoader(App.class.getResource("gui.fxml"));
Scene sceKenngruppe = new Scene(layout1, 234, 137); Scene sceApp = new Scene(guiLoader.load(), 962, 677);
FXMLLoader guiLoader = new FXMLLoader(App.class.getResource("gui.fxml")); tfEingabe.setOnKeyPressed(e -> {
if (e.getCode() == KeyCode.ENTER) {
Scene sceApp = new Scene(guiLoader.load(), 962, 677); if (enter(tfEingabe.getText())) {
gc = guiLoader.getController();
tfield.setOnKeyPressed(e -> { gc.setKenngruppe(tfEingabe.getText());
if (e.getCode() == KeyCode.ENTER) { primaryStage.setScene(sceApp);
if (enter(tfield.getText())) { } else {
gc = guiLoader.getController(); tfEingabe.setText("");
gc.setKenngruppe(tfield.getText()); new Fehler().showErrorDialog("error", "Kenngruppe falsch",
primaryStage.setScene(sceApp); "Regeln für die Kenngruppe: 4-8 Zeichen sowie nur Buchstaben von A-Z.");
} else { }
tfield.setText(""); }
new Fehler().showErrorDialog("error", "Kenngruppe falsch", });
"Regeln für die Kenngruppe: 4-8 Zeichen sowie nur Buchstaben von A-Z."); btnKenngruppe.setOnAction(e -> {
} if (enter(tfEingabe.getText())) {
} gc = guiLoader.getController();
}); gc.setKenngruppe(tfEingabe.getText());
primaryStage.setScene(sceApp);
button1.setOnAction(e -> { } else {
if (enter(tfield.getText())) { tfEingabe.setText("");
gc = guiLoader.getController(); new Fehler().showErrorDialog("error", "Kenngruppe falsch",
gc.setKenngruppe(tfield.getText()); "Regeln für die Kenngruppe: 4-8 Zeichen sowie Buchstaben von A-Z.");
primaryStage.setScene(sceApp); }
} else { });
tfield.setText(""); primaryStage.setScene(sceKenngruppe);
new Fehler().showErrorDialog("error", "Kenngruppe falsch", primaryStage.show();
"Regeln für die Kenngruppe: 4-8 Zeichen sowie Buchstaben von A-Z."); }
}
}); private boolean enter(String kenngruppe) {
primaryStage.setScene(sceKenngruppe); String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
primaryStage.show(); boolean result = true;
}
for (char c : kenngruppe.toUpperCase().toCharArray()) {
private boolean enter(String kenngruppe) { if (!alphabet.contains(String.valueOf(c))) {
result = false;
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; break;
boolean result = true; }
}
for (char c : kenngruppe.toUpperCase().toCharArray()) { if (kenngruppe.length() > 8 || kenngruppe.length() < 4) {
if (!alphabet.contains(String.valueOf(c))) { result = false;
result = false; }
break;
} return result;
} }
if (kenngruppe.length() > 8 || kenngruppe.length() < 4) {
result = false;
}
return result;
}
// /** // /**
// * TODO Dokumentieren // * TODO Dokumentieren
......
...@@ -671,52 +671,52 @@ ...@@ -671,52 +671,52 @@
</Label> </Label>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port0" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port0" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port1" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port1" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port2" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port2" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="4" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="4" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port3" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port3" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="5" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="5" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port4" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port4" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="6" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="6" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port5" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port5" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="7" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="7" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port6" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port6" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="8" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="8" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port7" layoutY="-304.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port7" disable="true" layoutY="-304.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="9" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="9" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port8" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port8" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="10" GridPane.rowIndex="7"> <Pane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="10" GridPane.rowIndex="7">
<children> <children>
<Pane fx:id="port9" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" /> <Pane fx:id="port9" disable="true" layoutX="-3.0" layoutY="-303.0" prefHeight="346.0" prefWidth="86.0" visible="false" />
</children> </children>
</Pane> </Pane>
</children> </children>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment