Skip to content
Snippets Groups Projects
Commit 217ae4b1 authored by Jan Schubert's avatar Jan Schubert
Browse files

2 Szenen für Kenngruppe und Gui. Stand 3.12. 08:40

parent a5968a82
No related branches found
No related tags found
1 merge request!91Master
......@@ -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();
// }
}
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