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

Merge branch 'master' into 'master'

fxml Datei 02.12. 13:28

See merge request alfatrainingkurse/java/enigma!82
parents bb3b32fb b7407ffe
No related branches found
No related tags found
No related merge requests found
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();
}
}
package projekt.enigma; package projekt.enigma;
import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
import javafx.fxml.FXML; 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 { public class KenngruppeController {
private Codierer cod = new Codierer();
private Stage stage;
@FXML @FXML
private void switchToPrimary() throws IOException { private TextField tfKenngruppe;
App.setRoot("gui");
@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
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
<Insets left="10.0" right="10.0" /> <Insets left="10.0" right="10.0" />
</GridPane.margin> </GridPane.margin>
</TextField> </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>
<Font name="System Bold" size="18.0" /> <Font name="System Bold" size="18.0" />
</font> </font>
......
...@@ -2,21 +2,20 @@ ...@@ -2,21 +2,20 @@
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<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> <children>
<Label layoutX="81.0" layoutY="29.0" text="Bitte Kenngruppe eingeben!" AnchorPane.leftAnchor="81.0" AnchorPane.rightAnchor="70.0" AnchorPane.topAnchor="29.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">
<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">
<children> <children>
<Button fx:id="secondaryButton" onAction="#switchToPrimary" prefHeight="25.0" prefWidth="142.0" text="Kenngruppe bestätigen!" /> <Label alignment="CENTER" contentDisplay="CENTER" prefHeight="17.0" prefWidth="208.0" text="Bitte Kenngruppe eingeben!" />
<Label prefHeight="17.0" prefWidth="159.0" text="Label" /> <Label prefHeight="62.0" prefWidth="209.0" />
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="150.0" text="Button" /> <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> </children>
</HBox> </VBox>
<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!" />
</children> </children>
</AnchorPane> </AnchorPane>
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