commit dd0aed8d06dc2c8d2231ec57219808ef2b2ca523 Author: programacionThiar Date: Tue May 21 18:53:55 2024 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8857c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,90 @@ +############################## +## Java +############################## +.mtj.tmp/ +*.class +*.jar +*.war +*.ear +*.nar +hs_err_pid* +replay_pid* + +############################## +## Maven +############################## +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +pom.xml.bak +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +############################## +## Gradle +############################## +bin/ +build/ +.gradle +.gradletasknamecache +gradle-app.setting +!gradle-wrapper.jar + +############################## +## IntelliJ +############################## +out/ +.idea/ +.idea_modules/ +*.iml +*.ipr +*.iws + +############################## +## Eclipse +############################## +.settings/ +bin/ +tmp/ +.metadata +.classpath +.project +*.tmp +*.bak +*.swp +*~.nib +local.properties +.loadpath +.factorypath + +############################## +## NetBeans +############################## +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml + +############################## +## Visual Studio Code +############################## +.vscode/ +.code-workspace + +############################## +## OS X +############################## +.DS_Store + +############################## +## Miscellaneous +############################## +*.log \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b707a8 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Proyecto t14ejemplos + +Se deben modificar los archivos: + +- README.md con las descripción del proyecto +- pom.xml con los nombre del proyecto y el artefacto + + +### (Proyecto creado usando la plantilla plantilla_iesthiar_javafx) \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8da762a --- /dev/null +++ b/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + iesthiar + t14ejemplos + 1.0-SNAPSHOT + + UTF-8 + 21 + 21 + + + + org.openjfx + javafx-controls + 21 + + + org.openjfx + javafx-fxml + 21 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + + default-cli + + iesthiar.App + + + + + + + diff --git a/src/main/java/iesthiar/App.java b/src/main/java/iesthiar/App.java new file mode 100644 index 0000000..f58aa40 --- /dev/null +++ b/src/main/java/iesthiar/App.java @@ -0,0 +1,38 @@ +package iesthiar; + +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 { + + private static Scene scene; + + @Override + public void start(Stage stage) throws IOException { + scene = new Scene(loadFXML("primary"), 640, 480); + 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(App.class.getResource(fxml + ".fxml")); + return fxmlLoader.load(); + } + + public static void main(String[] args) { + launch(); + } + +} \ No newline at end of file diff --git a/src/main/java/iesthiar/PrimaryController.java b/src/main/java/iesthiar/PrimaryController.java new file mode 100644 index 0000000..3d351a4 --- /dev/null +++ b/src/main/java/iesthiar/PrimaryController.java @@ -0,0 +1,12 @@ +package iesthiar; + +import java.io.IOException; +import javafx.fxml.FXML; + +public class PrimaryController { + + @FXML + private void switchToSecondary() throws IOException { + App.setRoot("secondary"); + } +} diff --git a/src/main/java/iesthiar/SecondaryController.java b/src/main/java/iesthiar/SecondaryController.java new file mode 100644 index 0000000..cdb14da --- /dev/null +++ b/src/main/java/iesthiar/SecondaryController.java @@ -0,0 +1,12 @@ +package iesthiar; + +import java.io.IOException; +import javafx.fxml.FXML; + +public class SecondaryController { + + @FXML + private void switchToPrimary() throws IOException { + App.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..e58bae0 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module iesthiar { + requires javafx.controls; + requires javafx.fxml; + + opens iesthiar to javafx.fxml; + exports iesthiar; +} diff --git a/src/main/resources/iesthiar/primary.fxml b/src/main/resources/iesthiar/primary.fxml new file mode 100644 index 0000000..32c3793 --- /dev/null +++ b/src/main/resources/iesthiar/primary.fxml @@ -0,0 +1,16 @@ + + + + + + + + + +