From 4f9d4b93c24ab32cc4a03f1ee35602af2d691e61 Mon Sep 17 00:00:00 2001 From: name Date: Tue, 15 Dec 2020 11:24:24 +0100 Subject: [PATCH 1/5] test files removed --- src/main/java/test.java | 7 ------- test.txt | 1 - 2 files changed, 8 deletions(-) delete mode 100644 src/main/java/test.java delete mode 100644 test.txt diff --git a/src/main/java/test.java b/src/main/java/test.java deleted file mode 100644 index 604d790..0000000 --- a/src/main/java/test.java +++ /dev/null @@ -1,7 +0,0 @@ -public class test{ - public static void main(String[] args){ - System.out.println("Il n'y a rien a voir !"); - System.out.println("nico fait un test"); - System.out.println("Il Je test les branchs"); - } -} \ No newline at end of file diff --git a/test.txt b/test.txt deleted file mode 100644 index cc7c4bd..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -azersdfglkjqnv,osdgfithez \ No newline at end of file From b42888dc5d07e9fd948e5bbedc49f9c391787d1b Mon Sep 17 00:00:00 2001 From: name Date: Tue, 15 Dec 2020 11:28:32 +0100 Subject: [PATCH 2/5] Example files of JavaFX added from openjfx --- src/main/java/fr/myny/gui/Gui.java | 33 +++++++++++++++++++ .../java/fr/myny/gui/PrimaryController.java | 13 ++++++++ .../java/fr/myny/gui/SecondaryController.java | 13 ++++++++ src/main/java/module-info.java | 7 ++++ src/main/resources/fr/myny/gui/primary.fxml | 13 ++++++++ src/main/resources/fr/myny/gui/secondary.fxml | 14 ++++++++ 6 files changed, 93 insertions(+) create mode 100644 src/main/java/fr/myny/gui/Gui.java create mode 100644 src/main/java/fr/myny/gui/PrimaryController.java create mode 100644 src/main/java/fr/myny/gui/SecondaryController.java create mode 100644 src/main/java/module-info.java create mode 100644 src/main/resources/fr/myny/gui/primary.fxml create mode 100644 src/main/resources/fr/myny/gui/secondary.fxml diff --git a/src/main/java/fr/myny/gui/Gui.java b/src/main/java/fr/myny/gui/Gui.java new file mode 100644 index 0000000..633d32b --- /dev/null +++ b/src/main/java/fr/myny/gui/Gui.java @@ -0,0 +1,33 @@ +package fr.myny.gui; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; +import java.io.IOException; + +public class Gui extends Application { + + private static Scene scene; + + @Override + public void start(Stage stage) throws IOException { + scene = new Scene(loadFXML("primary")); + stage.setScene(scene); + stage.show(); + } + + static void setRoot(String fxml) throws IOException { + scene.setRoot(loadFXML(fxml)); + } + + private static Parent loadFXML(String fxml) throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(Gui.class.getResource(fxml + ".fxml")); + return fxmlLoader.load(); + } + + public static void main(String[] args) { + launch(); + } +} diff --git a/src/main/java/fr/myny/gui/PrimaryController.java b/src/main/java/fr/myny/gui/PrimaryController.java new file mode 100644 index 0000000..b3e3df4 --- /dev/null +++ b/src/main/java/fr/myny/gui/PrimaryController.java @@ -0,0 +1,13 @@ +package fr.myny.gui; + +import javafx.fxml.FXML; + +import java.io.IOException; + +public class PrimaryController { + + @FXML + private void switchToSecondary() throws IOException { + Gui.setRoot("secondary"); + } +} diff --git a/src/main/java/fr/myny/gui/SecondaryController.java b/src/main/java/fr/myny/gui/SecondaryController.java new file mode 100644 index 0000000..ed9f6bd --- /dev/null +++ b/src/main/java/fr/myny/gui/SecondaryController.java @@ -0,0 +1,13 @@ +package fr.myny.gui; + +import javafx.fxml.FXML; + +import java.io.IOException; + +public class SecondaryController { + + @FXML + private void switchToPrimary() throws IOException { + Gui.setRoot("primary"); + } +} \ No newline at end of file diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..8065c10 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module fr.myny.gui { + requires javafx.controls; + requires javafx.fxml; + + opens fr.myny.gui to javafx.fxml; + exports fr.myny.gui; +} \ No newline at end of file diff --git a/src/main/resources/fr/myny/gui/primary.fxml b/src/main/resources/fr/myny/gui/primary.fxml new file mode 100644 index 0000000..a6104cf --- /dev/null +++ b/src/main/resources/fr/myny/gui/primary.fxml @@ -0,0 +1,13 @@ + + + + + + + +