diff --git a/Code/Steiner/uefa_uebung/bin/App.class b/Code/Steiner/uefa_uebung/bin/App.class index baa6c67..3c907fc 100644 Binary files a/Code/Steiner/uefa_uebung/bin/App.class and b/Code/Steiner/uefa_uebung/bin/App.class differ diff --git a/Code/Steiner/uefa_uebung/src/App.java b/Code/Steiner/uefa_uebung/src/App.java index 0a839f9..b184974 100644 --- a/Code/Steiner/uefa_uebung/src/App.java +++ b/Code/Steiner/uefa_uebung/src/App.java @@ -1,5 +1,5 @@ public class App { public static void main(String[] args) throws Exception { System.out.println("Hello, World!"); - } + }ยง } diff --git a/Code/ost/_04_several_scenes/src/main/java/com/example/App.java b/Code/ost/_04_several_scenes/src/main/java/com/example/App.java index f7f7cfc..899f69c 100644 --- a/Code/ost/_04_several_scenes/src/main/java/com/example/App.java +++ b/Code/ost/_04_several_scenes/src/main/java/com/example/App.java @@ -2,29 +2,43 @@ package com.example; import javafx.application.Application; import javafx.scene.Scene; +import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; import javafx.stage.Stage; - -/** - * JavaFX App - */ public class App extends Application { + private Scene scene1, scene2; + @Override public void start(Stage stage) { - var javaVersion = SystemInfo.javaVersion(); - var javafxVersion = SystemInfo.javafxVersion(); + // First scene with distinct text + Label label1 = new Label("Welcome to Scene 1!"); + Button switchToScene2 = new Button("Switch to Scene 2"); + VBox layout1 = new VBox(20, label1, switchToScene2); // VBox with spacing between elements + layout1.setStyle("-fx-alignment: center;"); // Center-align VBox contents + scene1 = new Scene(layout1, 640, 480); - var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."); - var scene = new Scene(new StackPane(label), 640, 480); - stage.setScene(scene); + // Second scene with distinct text + Label label2 = new Label("You are now in Scene 2!"); + Button switchToScene1 = new Button("Switch to Scene 1"); + VBox layout2 = new VBox(20, label2, switchToScene1); // VBox with spacing between elements + layout2.setStyle("-fx-alignment: center;"); // Center-align VBox contents + scene2 = new Scene(layout2, 640, 480); + + // Button actions to switch scenes + switchToScene2.setOnAction(e -> stage.setScene(scene2)); + switchToScene1.setOnAction(e -> stage.setScene(scene1)); + + // Set initial scene and show the stage + stage.setScene(scene1); + stage.setTitle("Scene Switcher"); stage.show(); } public static void main(String[] args) { launch(); } - -} \ No newline at end of file +} diff --git a/Code/ost/_04_several_scenes/target/classes/com/example/App.class b/Code/ost/_04_several_scenes/target/classes/com/example/App.class new file mode 100644 index 0000000..6af1eda Binary files /dev/null and b/Code/ost/_04_several_scenes/target/classes/com/example/App.class differ diff --git a/Code/ost/_04_several_scenes/target/classes/com/example/SystemInfo.class b/Code/ost/_04_several_scenes/target/classes/com/example/SystemInfo.class new file mode 100644 index 0000000..487f8e1 Binary files /dev/null and b/Code/ost/_04_several_scenes/target/classes/com/example/SystemInfo.class differ diff --git a/Code/ost/_04_several_scenes/target/classes/module-info.class b/Code/ost/_04_several_scenes/target/classes/module-info.class new file mode 100644 index 0000000..5e9b472 Binary files /dev/null and b/Code/ost/_04_several_scenes/target/classes/module-info.class differ diff --git a/Code/ost/_05_layouts/pom.xml b/Code/ost/_05_layouts/pom.xml new file mode 100644 index 0000000..7d9571b --- /dev/null +++ b/Code/ost/_05_layouts/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.example + _05_layouts + 1.0-SNAPSHOT + + UTF-8 + 11 + 11 + + + + org.openjfx + javafx-controls + 13 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + + default-cli + + com.example.App + + + + + + + diff --git a/Code/ost/_05_layouts/src/main/java/com/example/App.java b/Code/ost/_05_layouts/src/main/java/com/example/App.java new file mode 100644 index 0000000..4419fa3 --- /dev/null +++ b/Code/ost/_05_layouts/src/main/java/com/example/App.java @@ -0,0 +1,44 @@ +package com.example; + +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.AnchorPane; +import javafx.stage.Stage; + +/** + * JavaFX App with AnchorPane layout + */ +public class App extends Application { + + @Override + public void start(Stage stage) { + // Create AnchorPane + AnchorPane anchorPane = new AnchorPane(); + + // Create Controll button + Button controlButton = new Button("Button"); + AnchorPane.setTopAnchor(controlButton, 50.0); + AnchorPane.setLeftAnchor(controlButton, 50.0); + AnchorPane.setRightAnchor(controlButton, 10.0); + AnchorPane.setBottomAnchor(controlButton, 10.0); + + // Create Button 1 + Button button1 = new Button("Button 1"); + AnchorPane.setTopAnchor(button1, 10.0); + AnchorPane.setLeftAnchor(button1, 10.0); + + // Add buttons to the pane + anchorPane.getChildren().addAll(controlButton, button1); + + // Set up the Scene with AnchorPane + Scene scene = new Scene(anchorPane, 640, 480); + stage.setTitle("Hauptfenster with AnchorPane"); + stage.setScene(scene); + stage.show(); + } + + public static void main(String[] args) { + launch(); + } +} diff --git a/Code/ost/_05_layouts/src/main/java/com/example/SystemInfo.java b/Code/ost/_05_layouts/src/main/java/com/example/SystemInfo.java new file mode 100644 index 0000000..b566a3e --- /dev/null +++ b/Code/ost/_05_layouts/src/main/java/com/example/SystemInfo.java @@ -0,0 +1,13 @@ +package com.example; + +public class SystemInfo { + + public static String javaVersion() { + return System.getProperty("java.version"); + } + + public static String javafxVersion() { + return System.getProperty("javafx.version"); + } + +} \ No newline at end of file diff --git a/Code/ost/_05_layouts/src/main/java/module-info.java b/Code/ost/_05_layouts/src/main/java/module-info.java new file mode 100644 index 0000000..5918012 --- /dev/null +++ b/Code/ost/_05_layouts/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module com.example { + requires javafx.controls; + exports com.example; +} diff --git a/Code/ost/_05_layouts/target/classes/com/example/App.class b/Code/ost/_05_layouts/target/classes/com/example/App.class new file mode 100644 index 0000000..f1197e9 Binary files /dev/null and b/Code/ost/_05_layouts/target/classes/com/example/App.class differ diff --git a/Code/ost/_05_layouts/target/classes/com/example/SystemInfo.class b/Code/ost/_05_layouts/target/classes/com/example/SystemInfo.class new file mode 100644 index 0000000..487f8e1 Binary files /dev/null and b/Code/ost/_05_layouts/target/classes/com/example/SystemInfo.class differ diff --git a/Code/ost/_05_layouts/target/classes/module-info.class b/Code/ost/_05_layouts/target/classes/module-info.class new file mode 100644 index 0000000..5e9b472 Binary files /dev/null and b/Code/ost/_05_layouts/target/classes/module-info.class differ