├── .gitignore
├── CommandLine
├── Modular
│ ├── CLI
│ │ ├── README.md
│ │ └── hellofx
│ │ │ └── src
│ │ │ ├── hellofx
│ │ │ └── HelloFX.java
│ │ │ └── module-info.java
│ ├── Gradle
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── build.gradle
│ │ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ ├── hellofx
│ │ │ └── HelloFX.java
│ │ │ └── module-info.java
│ └── Maven
│ │ ├── README.md
│ │ └── hellofx
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ ├── module-info.java
│ │ └── org
│ │ │ └── openjfx
│ │ │ ├── FXMLController.java
│ │ │ └── MainApp.java
│ │ └── resources
│ │ └── org
│ │ └── openjfx
│ │ ├── scene.fxml
│ │ └── styles.css
└── Non-modular
│ ├── CLI
│ ├── README.md
│ └── hellofx
│ │ └── src
│ │ └── hellofx
│ │ ├── HelloFX.java
│ │ └── Launcher.java
│ ├── Gradle
│ ├── README.md
│ └── hellofx
│ │ ├── build.gradle
│ │ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── src
│ │ └── main
│ │ └── java
│ │ └── hellofx
│ │ ├── HelloFX.java
│ │ └── Launcher.java
│ └── Maven
│ ├── README.md
│ └── hellofx
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── hellofx
│ ├── HelloFX.java
│ └── Launcher.java
├── HelloFX
├── CLI
│ ├── README.md
│ └── hellofx
│ │ └── HelloFX.java
├── Gradle
│ ├── README.md
│ └── hellofx
│ │ ├── build.gradle
│ │ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── src
│ │ └── main
│ │ └── java
│ │ └── HelloFX.java
└── Maven
│ ├── README.md
│ └── hellofx
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── HelloFX.java
├── IDE
├── Eclipse
│ ├── Modular
│ │ ├── Gradle
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ │ ├── .classpath
│ │ │ │ ├── .project
│ │ │ │ ├── .settings
│ │ │ │ ├── hellofx.launch
│ │ │ │ ├── org.eclipse.buildship.core.prefs
│ │ │ │ └── org.eclipse.jdt.core.prefs
│ │ │ │ ├── build.gradle
│ │ │ │ ├── gradle.properties
│ │ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ │ ├── gradlew
│ │ │ │ ├── gradlew.bat
│ │ │ │ ├── settings.gradle
│ │ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── java
│ │ │ │ ├── module-info.java
│ │ │ │ └── org
│ │ │ │ │ └── openjfx
│ │ │ │ │ ├── FXMLController.java
│ │ │ │ │ └── MainApp.java
│ │ │ │ └── resources
│ │ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── scene.fxml
│ │ │ │ └── styles.css
│ │ ├── Java
│ │ │ ├── HelloFX
│ │ │ │ ├── .classpath
│ │ │ │ ├── .project
│ │ │ │ ├── .settings
│ │ │ │ │ ├── modHelloFX.launch
│ │ │ │ │ └── org.eclipse.jdt.core.prefs
│ │ │ │ └── src
│ │ │ │ │ ├── module-info.java
│ │ │ │ │ └── org
│ │ │ │ │ └── openjfx
│ │ │ │ │ ├── FXMLController.java
│ │ │ │ │ ├── MainApp.java
│ │ │ │ │ ├── scene.fxml
│ │ │ │ │ └── styles.css
│ │ │ └── README.md
│ │ └── Maven
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ ├── .classpath
│ │ │ ├── .project
│ │ │ ├── .settings
│ │ │ ├── hellofx.launch
│ │ │ ├── org.eclipse.core.resources.prefs
│ │ │ ├── org.eclipse.jdt.core.prefs
│ │ │ └── org.eclipse.m2e.core.prefs
│ │ │ ├── pom.xml
│ │ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── module-info.java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ └── hellofx
│ │ │ │ ├── App.java
│ │ │ │ ├── PrimaryController.java
│ │ │ │ └── SecondaryController.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ └── hellofx
│ │ │ ├── primary.fxml
│ │ │ ├── secondary.fxml
│ │ │ └── styles.css
│ └── Non-Modular
│ │ ├── Gradle
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── .classpath
│ │ │ ├── .project
│ │ │ ├── .settings
│ │ │ ├── hellofx.launch
│ │ │ ├── org.eclipse.buildship.core.prefs
│ │ │ └── org.eclipse.jdt.core.prefs
│ │ │ ├── build.gradle
│ │ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── settings.gradle
│ │ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── FXMLController.java
│ │ │ │ └── MainApp.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ ├── scene.fxml
│ │ │ └── styles.css
│ │ ├── Java
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── .classpath
│ │ │ ├── .project
│ │ │ ├── .settings
│ │ │ ├── HelloFX.launch
│ │ │ └── org.eclipse.jdt.core.prefs
│ │ │ └── src
│ │ │ └── hellofx
│ │ │ ├── Controller.java
│ │ │ ├── Main.java
│ │ │ └── hellofx.fxml
│ │ └── Maven
│ │ ├── README.md
│ │ └── hellofx
│ │ ├── .classpath
│ │ ├── .project
│ │ ├── .settings
│ │ ├── hellofx.launch
│ │ ├── org.eclipse.core.resources.prefs
│ │ ├── org.eclipse.jdt.core.prefs
│ │ └── org.eclipse.m2e.core.prefs
│ │ ├── pom.xml
│ │ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ └── hellofx
│ │ │ │ ├── App.java
│ │ │ │ ├── PrimaryController.java
│ │ │ │ └── SecondaryController.java
│ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ └── hellofx
│ │ │ ├── primary.fxml
│ │ │ ├── secondary.fxml
│ │ │ └── styles.css
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── openjfx
│ │ └── hellofx
│ │ └── AppTest.java
├── IntelliJ
│ ├── Modular
│ │ ├── Gradle
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ │ ├── build.gradle
│ │ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ │ ├── gradlew
│ │ │ │ ├── gradlew.bat
│ │ │ │ ├── settings.gradle
│ │ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── java
│ │ │ │ ├── module-info.java
│ │ │ │ └── org
│ │ │ │ │ └── openjfx
│ │ │ │ │ ├── FXMLController.java
│ │ │ │ │ └── MainApp.java
│ │ │ │ └── resources
│ │ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── scene.fxml
│ │ │ │ └── styles.css
│ │ ├── Java
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ │ ├── .idea
│ │ │ │ ├── encodings.xml
│ │ │ │ ├── misc.xml
│ │ │ │ ├── modules.xml
│ │ │ │ └── runConfigurations
│ │ │ │ │ └── runHelloFX.xml
│ │ │ │ └── src
│ │ │ │ ├── module-info.java
│ │ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── FXMLController.java
│ │ │ │ ├── MainApp.java
│ │ │ │ ├── scene.fxml
│ │ │ │ └── styles.css
│ │ └── Maven
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ ├── .idea
│ │ │ ├── compiler.xml
│ │ │ ├── encodings.xml
│ │ │ └── misc.xml
│ │ │ ├── hellofx.iml
│ │ │ ├── pom.xml
│ │ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── module-info.java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── App.java
│ │ │ │ ├── PrimaryController.java
│ │ │ │ └── SecondaryController.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ ├── primary.fxml
│ │ │ ├── secondary.fxml
│ │ │ └── styles.css
│ └── Non-Modular
│ │ ├── Gradle
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── .idea
│ │ │ ├── encodings.xml
│ │ │ ├── gradle.xml
│ │ │ └── misc.xml
│ │ │ ├── build.gradle
│ │ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── settings.gradle
│ │ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── FXMLController.java
│ │ │ │ └── MainApp.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ ├── scene.fxml
│ │ │ └── styles.css
│ │ ├── Java
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── .idea
│ │ │ ├── compiler.xml
│ │ │ ├── description.html
│ │ │ ├── encodings.xml
│ │ │ ├── gradle.xml
│ │ │ ├── misc.xml
│ │ │ ├── modules.xml
│ │ │ ├── runConfigurations
│ │ │ │ └── Main.xml
│ │ │ ├── uiDesigner.xml
│ │ │ └── vcs.xml
│ │ │ ├── hellofx.iml
│ │ │ └── src
│ │ │ └── hellofx
│ │ │ ├── Controller.java
│ │ │ ├── Main.java
│ │ │ └── hellofx.fxml
│ │ └── Maven
│ │ ├── README.md
│ │ └── hellofx
│ │ ├── .idea
│ │ ├── compiler.xml
│ │ ├── encodings.xml
│ │ └── misc.xml
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── openjfx
│ │ │ ├── App.java
│ │ │ ├── PrimaryController.java
│ │ │ └── SecondaryController.java
│ │ └── resources
│ │ └── org
│ │ └── openjfx
│ │ ├── primary.fxml
│ │ ├── secondary.fxml
│ │ └── styles.css
├── NetBeans
│ ├── Modular
│ │ ├── Gradle
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ │ ├── build.gradle
│ │ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ │ ├── gradlew
│ │ │ │ ├── gradlew.bat
│ │ │ │ ├── settings.gradle
│ │ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── java
│ │ │ │ ├── module-info.java
│ │ │ │ └── org
│ │ │ │ │ └── openjfx
│ │ │ │ │ ├── FXMLController.java
│ │ │ │ │ └── MainApp.java
│ │ │ │ └── resources
│ │ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── scene.fxml
│ │ │ │ └── styles.css
│ │ ├── Java
│ │ │ ├── HelloFX
│ │ │ │ ├── build.xml
│ │ │ │ ├── nbproject
│ │ │ │ │ ├── build-impl.xml
│ │ │ │ │ ├── genfiles.properties
│ │ │ │ │ ├── private
│ │ │ │ │ │ └── private.properties
│ │ │ │ │ ├── project.properties
│ │ │ │ │ └── project.xml
│ │ │ │ └── src
│ │ │ │ │ └── hellofx
│ │ │ │ │ └── classes
│ │ │ │ │ ├── module-info.java
│ │ │ │ │ └── org
│ │ │ │ │ └── openjfx
│ │ │ │ │ ├── FXMLController.java
│ │ │ │ │ ├── MainApp.java
│ │ │ │ │ ├── scene.fxml
│ │ │ │ │ └── styles.css
│ │ │ └── README.md
│ │ └── Maven
│ │ │ ├── README.md
│ │ │ └── hellofx
│ │ │ ├── nbactions.xml
│ │ │ ├── pom.xml
│ │ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── module-info.java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ └── hellofx
│ │ │ │ ├── App.java
│ │ │ │ ├── PrimaryController.java
│ │ │ │ └── SecondaryController.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ ├── primary.fxml
│ │ │ ├── secondary.fxml
│ │ │ └── styles.css
│ └── Non-Modular
│ │ ├── Gradle
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── build.gradle
│ │ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── settings.gradle
│ │ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── FXMLController.java
│ │ │ │ └── MainApp.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ ├── scene.fxml
│ │ │ └── styles.css
│ │ ├── Java
│ │ ├── README.md
│ │ └── hellofx
│ │ │ ├── build.xml
│ │ │ ├── manifest.mf
│ │ │ ├── nbproject
│ │ │ ├── build-impl.xml
│ │ │ ├── genfiles.properties
│ │ │ ├── private
│ │ │ │ └── private.xml
│ │ │ ├── project.properties
│ │ │ └── project.xml
│ │ │ └── src
│ │ │ └── hellofx
│ │ │ ├── Controller.java
│ │ │ ├── Main.java
│ │ │ └── hellofx.fxml
│ │ └── Maven
│ │ ├── README.md
│ │ └── hellofx
│ │ ├── nbactions.xml
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── openjfx
│ │ │ └── hellofx
│ │ │ ├── App.java
│ │ │ ├── PrimaryController.java
│ │ │ └── SecondaryController.java
│ │ └── resources
│ │ └── org
│ │ └── openjfx
│ │ └── hellofx
│ │ ├── primary.fxml
│ │ ├── secondary.fxml
│ │ └── styles.css
└── VSCode
│ ├── Modular
│ ├── Gradle
│ │ ├── README.md
│ │ ├── hellofx
│ │ │ ├── build.gradle
│ │ │ ├── gradle.properties
│ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── settings.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── java
│ │ │ │ ├── module-info.java
│ │ │ │ └── org
│ │ │ │ │ └── openjfx
│ │ │ │ │ ├── FXMLController.java
│ │ │ │ │ └── MainApp.java
│ │ │ │ └── resources
│ │ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── scene.fxml
│ │ │ │ └── styles.css
│ │ └── run.png
│ └── Maven
│ │ ├── README.md
│ │ ├── hellofx
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── module-info.java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ └── hellofx
│ │ │ │ ├── App.java
│ │ │ │ ├── PrimaryController.java
│ │ │ │ └── SecondaryController.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ └── hellofx
│ │ │ ├── primary.fxml
│ │ │ ├── secondary.fxml
│ │ │ └── styles.css
│ │ └── run.png
│ └── Non-Modular
│ ├── Gradle
│ ├── README.md
│ ├── hellofx
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ ├── settings.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── org
│ │ │ │ └── openjfx
│ │ │ │ ├── FXMLController.java
│ │ │ │ └── MainApp.java
│ │ │ └── resources
│ │ │ └── org
│ │ │ └── openjfx
│ │ │ ├── scene.fxml
│ │ │ └── styles.css
│ └── run.png
│ ├── Java
│ ├── README.md
│ └── hellofx
│ │ ├── .vscode
│ │ ├── launch.json
│ │ └── settings.json
│ │ └── src
│ │ └── hellofx
│ │ ├── Controller.java
│ │ ├── Main.java
│ │ └── hellofx.fxml
│ └── Maven
│ ├── README.md
│ ├── hellofx
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── openjfx
│ │ │ └── hellofx
│ │ │ ├── App.java
│ │ │ ├── PrimaryController.java
│ │ │ └── SecondaryController.java
│ │ └── resources
│ │ └── org
│ │ └── openjfx
│ │ └── hellofx
│ │ ├── primary.fxml
│ │ ├── secondary.fxml
│ │ └── styles.css
│ └── run.png
├── LICENSE
├── README.md
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle
2 | .gradle/
3 | target/
4 |
5 | # Maven
6 | build/
7 |
8 | # Eclipse
9 | bin/
10 |
11 | # IntelliJ IDEA
12 | .idea/
13 | *.iml
14 |
15 | MacOS
16 | .DS_Store
17 |
--------------------------------------------------------------------------------
/CommandLine/Modular/CLI/README.md:
--------------------------------------------------------------------------------
1 | # samples
2 |
3 | JavaFX samples to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
9 | system and unzip to a desired location.
10 |
11 | Download [JavaFX jmods](https://gluonhq.com/products/javafx/) for your operating
12 | system and unzip to a desired location.
13 |
14 | ## Modular - CLI
15 |
16 | `hellofx` sample modular project to run on command line, without build tools
17 |
18 | ### Linux / Mac
19 |
20 | If you run on Linux or Mac, follow these steps:
21 |
22 | cd CommandLine/Modular/CLI/hellofx
23 | export PATH_TO_FX=path/to/javafx-sdk/lib
24 | export PATH_TO_FX_MODS=path/to/javafx-jmods
25 | javac --module-path $PATH_TO_FX -d mods/hellofx $(find src -name "*.java")
26 |
27 | To run the project:
28 |
29 | java --module-path $PATH_TO_FX:mods -m hellofx/hellofx.HelloFX
30 |
31 | To create and run a custom JRE:
32 |
33 | $JAVA_HOME/bin/jlink --module-path $PATH_TO_FX_MODS:mods --add-modules hellofx --output hellofx
34 | hellofx/bin/java -m hellofx/hellofx.HelloFX
35 |
36 | ### Windows
37 |
38 | If you run on Windows, follow these steps:
39 |
40 | cd CommandLine\Modular\CLI\hellofx
41 | set PATH_TO_FX="path\to\javafx-sdk\lib"
42 | set PATH_TO_FX_MODS="path\to\javafx-jmods"
43 | dir /s /b src\*.java > sources.txt & javac --module-path %PATH_TO_FX% -d mods/hellofx @sources.txt & del sources.txt
44 |
45 | To run the project:
46 |
47 | java --module-path "%PATH_TO_FX%;mods" -m hellofx/hellofx.HelloFX
48 |
49 | To create and run a custom JRE:
50 |
51 | jlink --module-path "%PATH_TO_FX_MODS%;mods" --add-modules hellofx --output hellofx
52 | hellofx\bin\java -m hellofx/hellofx.HelloFX
53 |
--------------------------------------------------------------------------------
/CommandLine/Modular/CLI/hellofx/src/hellofx/HelloFX.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.scene.Scene;
5 | import javafx.scene.control.Label;
6 | import javafx.scene.layout.StackPane;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class HelloFX extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) {
14 | String javaVersion = System.getProperty("java.version");
15 | String javafxVersion = System.getProperty("javafx.version");
16 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
17 | Scene scene = new Scene(new StackPane(l), 640, 480);
18 | stage.setScene(scene);
19 | stage.show();
20 | }
21 |
22 | public static void main(String[] args) {
23 | launch();
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/CommandLine/Modular/CLI/hellofx/src/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 |
4 | exports hellofx;
5 | }
--------------------------------------------------------------------------------
/CommandLine/Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | # samples
2 |
3 | JavaFX samples to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## Modular - Gradle
9 |
10 | `hellofx` sample modular project to run with Gradle
11 |
12 | ### Linux / Mac
13 |
14 | If you run on Linux or Mac, follow these steps:
15 |
16 | cd CommandLine/Modular/Gradle/hellofx
17 |
18 | To run the project:
19 |
20 | ./gradlew run
21 |
22 | To create custom JRE you can use the `org.beryx.jlink` plugin:
23 |
24 | ./gradlew jlink
25 | build/image/bin/hellofx
26 |
27 | ### Windows
28 |
29 | If you run on Windows, follow these steps:
30 |
31 | cd CommandLine\Modular\Gradle\hellofx
32 |
33 | To run the project:
34 |
35 | gradlew run
36 |
37 | To create custom JRE with the `org.beryx.jlink` plugin:
38 |
39 | gradlew jlink
40 | build\image\bin\hellofx
41 |
--------------------------------------------------------------------------------
/CommandLine/Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | id 'org.beryx.jlink' version '2.26.0'
5 | }
6 |
7 | repositories {
8 | mavenCentral()
9 | }
10 |
11 | javafx {
12 | version = "21"
13 | modules = [ 'javafx.controls' ]
14 | }
15 |
16 | application {
17 | mainClass = "hellofx.HelloFX"
18 | mainModule = "hellofx"
19 | }
20 |
21 |
22 | jlink {
23 | options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
24 | launcher {
25 | name = 'hellofx'
26 | }
27 | }
--------------------------------------------------------------------------------
/CommandLine/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/CommandLine/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CommandLine/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/CommandLine/Modular/Gradle/hellofx/src/main/java/hellofx/HelloFX.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.scene.Scene;
5 | import javafx.scene.control.Label;
6 | import javafx.scene.layout.StackPane;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class HelloFX extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) {
14 | String javaVersion = System.getProperty("java.version");
15 | String javafxVersion = System.getProperty("javafx.version");
16 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
17 | Scene scene = new Scene(new StackPane(l), 640, 480);
18 | stage.setScene(scene);
19 | stage.show();
20 | }
21 |
22 | public static void main(String[] args) {
23 | launch();
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/CommandLine/Modular/Gradle/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 |
4 | exports hellofx;
5 | }
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | # samples
2 |
3 | JavaFX samples to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## Modular - Maven
9 |
10 | `hellofx` sample modular project to run with Maven
11 |
12 | ### Linux / Mac
13 |
14 | If you run on Linux or Mac, follow these steps:
15 |
16 | cd CommandLine/Modular/Maven/hellofx
17 | mvn clean javafx:run
18 |
19 | To create and run a custom JRE:
20 |
21 | cd CommandLine/Modular/Maven/hellofx
22 | mvn clean javafx:jlink
23 | target/hellofx/bin/launcher
24 |
25 | ### Windows
26 |
27 | If you run on Windows, follow these steps:
28 |
29 | cd CommandLine\Modular\Maven\hellofx
30 | mvn clean javafx:run
31 |
32 | To create and run a custom JRE:
33 |
34 | cd CommandLine/Modular/Maven/hellofx
35 | mvn clean javafx:jlink
36 | target\hellofx\bin\launcher
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | org.openjfx
6 | hellofx
7 | 1.0-SNAPSHOT
8 | jar
9 |
10 | hellofx
11 |
12 |
13 | UTF-8
14 | 17
15 | 21
16 | 0.0.8
17 |
18 |
19 |
20 |
21 | Your Organisation
22 |
23 |
24 |
25 |
26 | org.openjfx
27 | javafx-controls
28 | ${javafx.version}
29 |
30 |
31 | org.openjfx
32 | javafx-fxml
33 | ${javafx.version}
34 |
35 |
36 |
37 |
38 |
39 | org.apache.maven.plugins
40 | maven-compiler-plugin
41 | 3.11.0
42 |
43 |
44 | org.openjfx
45 | javafx-maven-plugin
46 | ${javafx.maven.plugin.version}
47 |
48 | hellofx
49 | launcher
50 | hellofx/org.openjfx.MainApp
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx;
7 | }
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.event.ActionEvent;
4 | import javafx.fxml.FXML;
5 | import javafx.scene.control.Label;
6 |
7 | public class FXMLController {
8 |
9 | @FXML
10 | private Label label;
11 |
12 | @FXML
13 | private void handleButtonAction(ActionEvent event) {
14 | System.out.println("You clicked me!");
15 | label.setText("Hello World!");
16 | }
17 |
18 | public void initialize() {
19 | // TODO
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Maven");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/CommandLine/Modular/Maven/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-font-weight: bold;
3 | }
4 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/CLI/README.md:
--------------------------------------------------------------------------------
1 | # samples
2 |
3 | JavaFX samples to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
9 | system and unzip to a desired location.
10 |
11 | ## Non-modular - CLI
12 |
13 | `hellofx` sample non-modular project to run on command line, without build tools
14 |
15 | ### Linux / Mac
16 |
17 | If you run on Linux or Mac, follow these steps:
18 |
19 | cd CommandLine/Non-modular/CLI/hellofx
20 | export PATH_TO_FX=path/to/javafx-sdk/lib
21 | javac --module-path $PATH_TO_FX --add-modules=javafx.controls -d out $(find src -name "*.java")
22 |
23 | To run the project:
24 |
25 | java --module-path $PATH_TO_FX --add-modules=javafx.controls -cp out hellofx.HelloFX
26 |
27 | To create a fat jar:
28 |
29 | find $PATH_TO_FX/{javafx.base.jar,javafx.graphics.jar,javafx.controls.jar} -exec unzip -nq {} -d out \;
30 |
31 | #uncomment for Linux:
32 | #cp $PATH_TO_FX/{libprism*.so,libjavafx*.so,libglass*.so,libdecora_sse.so} out
33 |
34 | #uncomment for Mac:
35 | #cp $PATH_TO_FX/{libprism*.dylib,libjavafx*.dylib,libglass.dylib,libdecora_sse.dylib} out
36 |
37 | rm out/META-INF/MANIFEST.MF out/module-info.class
38 | mkdir libs
39 | jar --create --file=libs/hellofx.jar --main-class=hellofx.Launcher -C out .
40 | java -jar libs/hellofx.jar
41 |
42 |
43 | ### Windows
44 |
45 | If you run on Windows, follow these steps:
46 |
47 | cd CommandLine\Non-modular\CLI\hellofx
48 | set PATH_TO_FX="path\to\javafx-sdk\lib"
49 | dir /s /b src\*.java > sources.txt & javac --module-path %PATH_TO_FX% --add-modules=javafx.controls -d out @sources.txt & del sources.txt
50 |
51 | To run the project:
52 |
53 | java --module-path %PATH_TO_FX% --add-modules=javafx.controls -cp out hellofx.HelloFX
54 |
55 | To create a fat jar:
56 |
57 | cd out & jar xf "%PATH_TO_FX%\javafx.base.jar" & jar xf "%PATH_TO_FX%\javafx.graphics.jar" & jar xf "%PATH_TO_FX%\javafx.controls.jar" & cd ..
58 | copy "%PATH_TO_FX%\..\bin\prism*.dll" out & copy "%PATH_TO_FX%\..\bin\javafx*.dll" out & copy "%PATH_TO_FX%\..\bin\glass.dll" out && copy "%PATH_TO_FX%\..\bin\decora_sse.dll" out
59 | del out\META-INF\MANIFEST.MF & del out\module-info.class
60 | mkdir libs
61 | jar --create --file=libs/hellofx.jar --main-class=hellofx.Launcher -C out .
62 | java -jar libs\hellofx.jar
63 |
64 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/CLI/hellofx/src/hellofx/HelloFX.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.scene.Scene;
5 | import javafx.scene.control.Label;
6 | import javafx.scene.layout.StackPane;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class HelloFX extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) {
14 | String javaVersion = System.getProperty("java.version");
15 | String javafxVersion = System.getProperty("javafx.version");
16 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
17 | Scene scene = new Scene(new StackPane(l), 640, 480);
18 | stage.setScene(scene);
19 | stage.show();
20 | }
21 |
22 | public static void main(String[] args) {
23 | launch();
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/CommandLine/Non-modular/CLI/hellofx/src/hellofx/Launcher.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | public class Launcher {
4 |
5 | public static void main(String[] args) {
6 | HelloFX.main(args);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | # samples
2 |
3 | JavaFX samples to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## Non-modular - Gradle
9 |
10 | `hellofx` sample non-modular project to run with Gradle
11 |
12 | ### Linux / Mac
13 |
14 | If you run on Linux or Mac, follow these steps:
15 |
16 | cd CommandLine/Non-modular/Gradle/hellofx
17 |
18 | To run the project:
19 |
20 | ./gradlew run
21 |
22 | To create a fat jar:
23 |
24 | ./gradlew jar
25 | java -jar build/libs/hellofx.jar
26 |
27 |
28 | ### Windows
29 |
30 | If you run on Windows, follow these steps:
31 |
32 | cd CommandLine\Non-modular\Gradle\hellofx
33 |
34 | To run the project:
35 |
36 | gradlew run
37 |
38 | To create a fat jar:
39 |
40 | gradlew jar
41 | java -jar build\libs\hellofx.jar
42 |
43 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | /* uncomment for cross-platform jar: */
12 | // runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"
13 | // runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
14 | // runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:mac"
15 | }
16 |
17 | javafx {
18 | version = "21"
19 | modules = [ 'javafx.controls' ]
20 | }
21 |
22 | mainClassName = 'hellofx.HelloFX'
23 |
24 | jar {
25 | manifest {
26 | attributes 'Main-Class': 'hellofx.Launcher'
27 | }
28 | from {
29 | configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
30 | }
31 | }
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/CommandLine/Non-modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Gradle/hellofx/src/main/java/hellofx/HelloFX.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.scene.Scene;
5 | import javafx.scene.control.Label;
6 | import javafx.scene.layout.StackPane;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class HelloFX extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) {
14 | String javaVersion = System.getProperty("java.version");
15 | String javafxVersion = System.getProperty("javafx.version");
16 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
17 | Scene scene = new Scene(new StackPane(l), 640, 480);
18 | stage.setScene(scene);
19 | stage.show();
20 | }
21 |
22 | public static void main(String[] args) {
23 | launch();
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Gradle/hellofx/src/main/java/hellofx/Launcher.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | public class Launcher {
4 |
5 | public static void main(String[] args) {
6 | HelloFX.main(args);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | # samples
2 |
3 | JavaFX samples to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## Non-modular - Maven
9 |
10 | `hellofx` sample non-modular project to run with Maven
11 |
12 | ### Linux / Mac
13 |
14 | If you run on Linux or Mac, follow these steps:
15 |
16 | cd CommandLine/Non-modular/Maven/hellofx
17 |
18 | To run the project:
19 |
20 | mvn clean javafx:run
21 |
22 | To create a fat jar:
23 |
24 | mvn compile package
25 | java -jar shade/hellofx.jar
26 |
27 |
28 | ### Windows
29 |
30 | If you run on Windows, follow these steps:
31 |
32 | cd CommandLine\Non-modular\Maven\hellofx
33 |
34 | To run the project:
35 |
36 | mvn compile exec:java
37 |
38 | To create a fat jar:
39 |
40 | mvn compile package
41 | java -jar shade\hellofx.jar
42 |
43 |
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Maven/hellofx/src/main/java/hellofx/HelloFX.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.scene.Scene;
5 | import javafx.scene.control.Label;
6 | import javafx.scene.layout.StackPane;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class HelloFX extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) {
14 | String javaVersion = System.getProperty("java.version");
15 | String javafxVersion = System.getProperty("javafx.version");
16 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
17 | Scene scene = new Scene(new StackPane(l), 640, 480);
18 | stage.setScene(scene);
19 | stage.show();
20 | }
21 |
22 | public static void main(String[] args) {
23 | launch();
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/CommandLine/Non-modular/Maven/hellofx/src/main/java/hellofx/Launcher.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | public class Launcher {
4 |
5 | public static void main(String[] args) {
6 | HelloFX.main(args);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/HelloFX/CLI/README.md:
--------------------------------------------------------------------------------
1 | # HelloFX Sample
2 |
3 | JavaFX HelloFX sample to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## CLI
9 |
10 | Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
11 | system and unzip to a desired location.
12 |
13 | ### Linux / Mac
14 |
15 | If you run on Linux or Mac, follow these steps:
16 |
17 | cd HelloFX/CLI/hellofx
18 | export PATH_TO_FX=path/to/javafx-sdk/lib
19 |
20 | Compile:
21 |
22 | javac --module-path $PATH_TO_FX --add-modules javafx.controls HelloFX.java
23 |
24 | Run:
25 |
26 | java --module-path $PATH_TO_FX --add-modules javafx.controls HelloFX
27 |
28 | ### Windows
29 |
30 | If you run on Windows, follow these steps:
31 |
32 | cd HelloFX\CLI\hellofx
33 | set PATH_TO_FX="path\to\javafx-sdk\lib"
34 |
35 | Compile:
36 |
37 | javac --module-path %PATH_TO_FX% --add-modules javafx.controls HelloFX.java
38 |
39 | Run:
40 |
41 | java --module-path %PATH_TO_FX% --add-modules javafx.controls HelloFX
--------------------------------------------------------------------------------
/HelloFX/CLI/hellofx/HelloFX.java:
--------------------------------------------------------------------------------
1 | import javafx.application.Application;
2 | import javafx.scene.Scene;
3 | import javafx.scene.control.Label;
4 | import javafx.scene.layout.StackPane;
5 | import javafx.stage.Stage;
6 |
7 | public class HelloFX extends Application {
8 |
9 | @Override
10 | public void start(Stage stage) {
11 | String javaVersion = System.getProperty("java.version");
12 | String javafxVersion = System.getProperty("javafx.version");
13 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
14 | Scene scene = new Scene(new StackPane(l), 640, 480);
15 | stage.setScene(scene);
16 | stage.show();
17 | }
18 |
19 | public static void main(String[] args) {
20 | launch();
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/HelloFX/Gradle/README.md:
--------------------------------------------------------------------------------
1 | # HelloFX Sample
2 |
3 | JavaFX HelloFX sample to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## Gradle
9 |
10 | ### Linux / Mac
11 |
12 | If you run on Linux or Mac, follow these steps:
13 |
14 | cd HelloFX/Gradle/hellofx
15 |
16 | To run the project:
17 |
18 | ./gradlew run
19 |
20 | ### Windows
21 |
22 | If you run on Windows, follow these steps:
23 |
24 | cd HelloFX\Gradle\hellofx
25 |
26 | To run the project:
27 |
28 | gradlew run
29 |
--------------------------------------------------------------------------------
/HelloFX/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | javafx {
11 | version = "21"
12 | modules = [ 'javafx.controls' ]
13 | }
14 |
15 | mainClassName = 'HelloFX'
16 |
--------------------------------------------------------------------------------
/HelloFX/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/HelloFX/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/HelloFX/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/HelloFX/Gradle/hellofx/src/main/java/HelloFX.java:
--------------------------------------------------------------------------------
1 | import javafx.application.Application;
2 | import javafx.scene.Scene;
3 | import javafx.scene.control.Label;
4 | import javafx.scene.layout.StackPane;
5 | import javafx.stage.Stage;
6 |
7 | public class HelloFX extends Application {
8 |
9 | @Override
10 | public void start(Stage stage) {
11 | String javaVersion = System.getProperty("java.version");
12 | String javafxVersion = System.getProperty("javafx.version");
13 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
14 | Scene scene = new Scene(new StackPane(l), 640, 480);
15 | stage.setScene(scene);
16 | stage.show();
17 | }
18 |
19 | public static void main(String[] args) {
20 | launch();
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/HelloFX/Maven/README.md:
--------------------------------------------------------------------------------
1 | # HelloFX Sample
2 |
3 | JavaFX HelloFX sample to run with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ## Maven
9 |
10 | ### Linux / Mac
11 |
12 | If you run on Linux or Mac, follow these steps:
13 |
14 | cd HelloFX/Maven/hellofx
15 |
16 | To compile and run the project:
17 |
18 | mvn clean javafx:run
19 |
20 | ### Windows
21 |
22 | If you run on Windows, follow these steps:
23 |
24 | cd HelloFX\Maven\hellofx
25 |
26 | To run the project:
27 |
28 | mvn clean javafx:run
--------------------------------------------------------------------------------
/HelloFX/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | jar
7 | 1.0-SNAPSHOT
8 | demo
9 | http://maven.apache.org
10 |
11 |
12 | UTF-8
13 | 21
14 | 0.0.8
15 |
16 |
17 |
18 |
19 | org.openjfx
20 | javafx-controls
21 | ${javafx.version}
22 |
23 |
24 |
25 |
26 |
27 |
28 | org.openjfx
29 | javafx-maven-plugin
30 | ${javafx.maven.plugin.version}
31 |
32 | HelloFX
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/HelloFX/Maven/hellofx/src/main/java/HelloFX.java:
--------------------------------------------------------------------------------
1 | import javafx.application.Application;
2 | import javafx.scene.Scene;
3 | import javafx.scene.control.Label;
4 | import javafx.scene.layout.StackPane;
5 | import javafx.stage.Stage;
6 |
7 | public class HelloFX extends Application {
8 |
9 | @Override
10 | public void start(Stage stage) {
11 | String javaVersion = System.getProperty("java.version");
12 | String javafxVersion = System.getProperty("javafx.version");
13 | Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
14 | Scene scene = new Scene(new StackPane(l), 640, 480);
15 | stage.setScene(scene);
16 | stage.show();
17 | }
18 |
19 | public static void main(String[] args) {
20 | launch();
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for Eclipse
2 |
3 | JavaFX samples to run from Eclipse with different options and build tools
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Gradle
9 |
10 | For the first time only:
11 |
12 | - Make sure you have the Buildship Gradle Integration plugin installed in Eclipse.
13 |
14 | - Add `org.gradle.java.home` to a `gradle.properties` file, with the path to JDK. This file
15 | can be part of the project or under the gradle user home `USER_HOME/.gradle`.
16 |
17 | Clone the sample, open it with Eclipse and refresh the Gradle project.
18 |
19 | Run from Gradle Tasks -> `application -> run`.
20 |
21 | Run from Gradle Tasks -> `other -> jlink` to create a custom runtime.
22 |
23 | #### Linux / Mac
24 |
25 | On Linux or Mac run:
26 |
27 | build/image/bin/hellofx
28 |
29 | #### Windows
30 |
31 | On Windows, run:
32 |
33 | build\image\bin\hellofx
34 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | HelloFX
4 | Project HelloFX created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/.settings/hellofx.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
3 | org.eclipse.jdt.core.compiler.compliance=12
4 | org.eclipse.jdt.core.compiler.source=12
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'eclipse'
4 | id 'org.openjfx.javafxplugin' version '0.1.0'
5 | id 'org.beryx.jlink' version '2.26.0'
6 | }
7 |
8 | repositories {
9 | mavenCentral()
10 | }
11 |
12 | javafx {
13 | version = "21"
14 | modules = [ 'javafx.controls', 'javafx.fxml' ]
15 | }
16 |
17 | application {
18 | mainClass = "org.openjfx.MainApp"
19 | mainModule = "hellofx"
20 | }
21 |
22 | jlink {
23 | options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
24 | launcher {
25 | name = 'hellofx'
26 | }
27 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/gradle.properties:
--------------------------------------------------------------------------------
1 | ## if JAVA_HOME is not JDK, set and uncomment:
2 | #org.gradle.java.home=/path/to/jdk/
3 |
4 |
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/Eclipse/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hellofx'
2 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 | requires transitive javafx.graphics;
5 |
6 | opens org.openjfx to javafx.fxml;
7 | exports org.openjfx;
8 | }
9 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | HelloFX
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/.settings/modHelloFX.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=11
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=11
13 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/src/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 | requires transitive javafx.graphics;
5 |
6 | opens org.openjfx to javafx.fxml;
7 | exports org.openjfx;
8 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/src/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/src/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/src/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/HelloFX/src/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for Eclipse
2 |
3 | JavaFX samples to run from Eclipse with different options and build tools
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Java
9 |
10 | - Download [JavaFX jmods](https://gluonhq.com/products/javafx/) for your operating
11 | system and unzip to a desired location.
12 |
13 | Clone the sample and open the project with Eclipse.
14 |
15 | Run with `Run configurations -> Java Application -> modHelloFX`
16 |
17 | To create and run a custom JRE, from terminal:
18 |
19 | On Linux or Mac run:
20 |
21 | cd IDE/Eclipse/Modular/Java/HelloFX
22 | export PATH_TO_FX_MODS=path/to/javafx-jmods
23 | $JAVA_HOME/bin/jlink --module-path $PATH_TO_FX_MODS:bin/hellofx --add-modules=hellofx --output jre
24 | jre/bin/java -m hellofx/org.openjfx.MainApp
25 |
26 | On Windows run:
27 |
28 | cd IDE\Eclipse\Modular\Java\HelloFX
29 | set PATH_TO_FX_MODS="path\to\javafx-jmods"
30 | jlink --module-path "%PATH_TO_FX_MODS%;bin\hellofx" --add-modules=hellofx --output jre
31 | jre\bin\java -m hellofx/org.openjfx.MainApp
32 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for Eclipse
2 |
3 | JavaFX samples to run from Eclipse with different options and build tools
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Maven
9 |
10 | For the first time only:
11 |
12 | - Make sure you have the Maven Integration for Eclipse m2e plugin installed.
13 |
14 | - Add the JavaFX Maven archetypes `org.openjfx:javafx-archetype-simple:0.0.1` and `org.openjfx:javafx-archetype-fxml:0.0.1`
15 |
16 | Clone the sample, open it with Eclipse, and make sure the paths for JDK and
17 | JavaFX match those on your machine.
18 |
19 | Run with `Run configurations -> Maven Build -> hellofx`.
20 |
21 | As well, this will work from the terminal:
22 |
23 | mvn clean javafx:run
24 |
25 | Note: on Windows, under Eclipse running Oracle JDK 1.8, you need to add `-Djava.library.path=C:\`
26 | to the JavaFX maven plugin:
27 |
28 |
29 | /path/to/JDK/bin/java
30 |
31 |
32 |
33 | hellofx/org.openjfx.hellofx.App
34 |
35 |
36 |
37 | #### Custom Runtime
38 |
39 | To create and run a custom JRE, from terminal:
40 |
41 | On Linux or Mac run:
42 |
43 | cd IDE/Eclipse/Modular/Maven/hellofx
44 | mvn clean javafx:jlink
45 | target/hellofx/bin/launcher
46 |
47 | On Windows run:
48 |
49 | cd IDE\Eclipse\Modular\Maven\hellofx
50 | mvn clean javafx:jlink
51 | target\hellofx\bin\launcher
52 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | hellofx
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/.settings/hellofx.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/main/resources=UTF-8
4 | encoding/=UTF-8
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
4 | org.eclipse.jdt.core.compiler.compliance=12
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
10 | org.eclipse.jdt.core.compiler.release=enabled
11 | org.eclipse.jdt.core.compiler.source=12
12 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | 0.0.1-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | hellofx
38 | launcher
39 | hellofx/org.openjfx.hellofx.App
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 | requires transitive javafx.graphics;
5 |
6 | opens org.openjfx to javafx.fxml;
7 | exports org.openjfx.hellofx;
8 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for Eclipse
2 |
3 | JavaFX samples to run from Eclipse with different options and build tools
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 |
9 | ### Gradle
10 |
11 | Clone the sample, add a `gradle.properties` file with this property:
12 |
13 | org.gradle.java.home=/path/to/JDK
14 |
15 | Open it with Eclipse and refresh the Gradle project.
16 |
17 | Run with Run configurations -> Gradle Project -> hellofx
18 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | HelloFX
4 | Project HelloFX created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/.settings/hellofx.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
3 | org.eclipse.jdt.core.compiler.compliance=12
4 | org.eclipse.jdt.core.compiler.source=12
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | }
12 |
13 | javafx {
14 | version = "21"
15 | modules = [ 'javafx.controls', 'javafx.fxml' ]
16 | }
17 |
18 | run {
19 | if (javafx.platform.classifier == 'win') {
20 | // Temporal fix for Eclipse with JDK 1.8 and Windows
21 | systemProperty "java.library.path", "C:\tmp"
22 | }
23 | }
24 |
25 | mainClassName = 'org.openjfx.MainApp'
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/Eclipse/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | *
6 | * Detailed information about configuring a multi-project build in Gradle can be found
7 | * in the user guide at https://docs.gradle.org/4.10.2/userguide/multi_project_builds.html
8 | */
9 |
10 | rootProject.name = 'hellofx'
11 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | label.setText("Hello, JavaFX");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for Eclipse
2 |
3 | JavaFX samples to run from Eclipse with different options and build tools
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Java
9 |
10 | For the first time only:
11 |
12 | - Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
13 | system and unzip to a desired location.
14 |
15 | - Open Eclipse and create a string substitution variable under `Preferences->Run/Debug->String Substitution`, named `PATH_TO_FX` and
16 | pointing to the JavaFX lib folder.
17 |
18 | - Create a User Library under `Eclipse -> Window -> Preferences -> Java -> Build Path -> User Libraries -> New`.
19 | Name it `JavaFXSDK` and include the jars under the lib folder from JavaFX.
20 |
21 | Clone the sample, open it with Eclipse, and make sure the paths for JDK and JavaFX match those on your machine.
22 |
23 | Build the project and run with Run configurations-> Java Application -> HelloFX.
24 |
25 | Note: Edit Run configurations... -> Arguments and make sure the option:
26 |
27 | > Use the -XstartOnFirstThread argument when launching with SWT
28 |
29 | is not selected.
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | HelloFX
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/.settings/HelloFX.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=12
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=12
15 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/src/hellofx/Controller.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class Controller {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/src/hellofx/Main.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | public class Main extends Application {
10 |
11 | @Override
12 | public void start(Stage primaryStage) throws Exception{
13 | Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml"));
14 | primaryStage.setTitle("Hello World");
15 | primaryStage.setScene(new Scene(root, 400, 300));
16 | primaryStage.show();
17 | }
18 |
19 |
20 | public static void main(String[] args) {
21 | launch(args);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Java/hellofx/src/hellofx/hellofx.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for Eclipse
2 |
3 | JavaFX samples to run from Eclipse with different options and build tools
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Maven
9 |
10 | For the first time only:
11 |
12 | - Make sure you have the Maven Integration for Eclipse m2e plugin installed.
13 |
14 | - Add the JavaFX Maven archetypes `org.openjfx:javafx-archetype-simple:0.0.1` and `org.openjfx:javafx-archetype-fxml:0.0.1`
15 |
16 | Clone the sample, open it with Eclipse and import the Maven changes.
17 |
18 | Run with `Run configurations -> Maven Build -> hellofx`.
19 |
20 | Note: on Windows, under Eclipse running Oracle JDK 1.8, you need to add `-Djava.library.path=C:\`
21 | to the JavaFX maven plugin:
22 |
23 |
24 | /path/to/JDK/bin/java
25 |
26 |
27 |
28 | org.openjfx.hellofx.App
29 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | hellofx
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/.settings/hellofx.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=UTF-8
3 | encoding//src/test/java=UTF-8
4 | encoding/=UTF-8
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=12
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
13 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
14 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
15 | org.eclipse.jdt.core.compiler.release=enabled
16 | org.eclipse.jdt.core.compiler.source=12
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | 1.0-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | org.openjfx.hellofx.App
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/Eclipse/Non-Modular/Maven/hellofx/src/test/java/org/openjfx/hellofx/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for IntelliJ
2 |
3 | JavaFX samples to run from IntelliJ with different options and build tools
4 |
5 | Version IntelliJ IDEA 20189.1
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
8 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
9 |
10 | Download [JavaFX jmods](https://gluonhq.com/products/javafx/) for your operating
11 | system and unzip to a desired location.
12 |
13 | ### Gradle
14 |
15 | Clone the sample, open it with IntelliJ and import the Gradle changes. Build and run
16 | from the Gradle window.
17 |
18 | To create custom JRE you can use the `org.beryx.jlink` plugin.
19 | To create and run the custom runtime image:
20 |
21 | #### Linux / Mac
22 |
23 | On Linux or Mac run:
24 |
25 | ./gradlew jlink
26 | build/image/bin/hellofx
27 |
28 | #### Windows
29 |
30 | On Windows, run:
31 |
32 | gradlew jlink
33 | build\image\bin\hellofx
34 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | id 'org.beryx.jlink' version '2.26.0'
5 | }
6 |
7 | repositories {
8 | mavenCentral()
9 | }
10 |
11 | javafx {
12 | version = "21"
13 | modules = [ 'javafx.controls', 'javafx.fxml' ]
14 | }
15 |
16 | application {
17 | mainClass = "org.openjfx.MainApp"
18 | mainModule = "hellofx"
19 | }
20 |
21 | jlink {
22 | options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
23 | launcher {
24 | name = 'hellofx'
25 | }
26 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/IntelliJ/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hellofx'
2 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx;
7 | }
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .label {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for IntelliJ
2 |
3 | JavaFX samples to run from IntelliJ with different options and build tools
4 |
5 | Version IntelliJ IDEA 2019.1
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
8 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
9 |
10 | Download [JavaFX jmods](https://gluonhq.com/products/javafx/) for your operating
11 | system and unzip to a desired location.
12 |
13 | ### Java
14 |
15 | Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
16 | system and unzip to a desired location.
17 |
18 | Clone the sample, open it with IntelliJ, and make sure the paths for JDK and JavaFX match those on your machine.
19 |
20 | Define the following Path Variables in Preferences/Settings:
21 | - name `PATH_TO_FX`, value `path/to/javafx-sdk/lib`
22 | - name `PATH_SEPARATOR`, value `:` on Linux/Mac, `;` on Windows.
23 |
24 | Run the `runHelloFX` configuration.
25 |
26 | To create and run a custom JRE, from terminal:
27 |
28 | On Linux or Mac run:
29 |
30 | cd IDE/IntelliJ/Modular/Java/hellofx
31 | export PATH_TO_FX_MODS=path/to/javafx-jmods
32 | $JAVA_HOME/bin/jlink --module-path $PATH_TO_FX_MODS:mods/production --add-modules hellofx --output jre
33 | jre/bin/java -m hellofx/org.openjfx.MainApp
34 |
35 | On Windows run:
36 |
37 | cd IDE\IntelliJ\Modular\Java\hellofx
38 | set PATH_TO_FX_MODS="path\to\javafx-jmods"
39 | jlink --module-path "%PATH_TO_FX_MODS%;mods\production" --add-modules hellofx --output jre
40 | jre\bin\java -m hellofx/org.openjfx.MainApp
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/.idea/runConfigurations/runHelloFX.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/src/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx;
7 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/src/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/src/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/src/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Java/hellofx/src/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .label {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for IntelliJ
2 |
3 | JavaFX samples to run from IntelliJ with different options and build tools
4 |
5 | Version IntelliJ IDEA 2019.1
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
8 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
9 |
10 | ### Maven
11 |
12 | Clone the sample, open it with IntelliJ, and make sure the paths for JDK and JavaFX match those on your machine.
13 |
14 | Run from command line:
15 |
16 | mvn clean javafx:run
17 |
18 | As well, this will work from the terminal on Linux or Mac:
19 |
20 | java --module-path $PATH_TO_FX:target/hellofx-1.0-SNAPSHOT.jar -m hellofx/org.openjfx.MainApp
21 |
22 | or on Windows:
23 |
24 | java --module-path %PATH_TO_FX%:target\hellofx-1.0-SNAPSHOT.jar -m hellofx/org.openjfx.MainApp
25 |
26 | To create and run a custom JRE, from terminal:
27 |
28 | On Linux or Mac run:
29 |
30 | cd IDE/IntelliJ/Modular/Maven/hellofx
31 | mvn clean javafx:jlink
32 | target/hellofx/bin/launcher
33 |
34 | On Windows run:
35 |
36 | cd IDE\IntelliJ\Modular\Maven\hellofx
37 | mvn clean javafx:jlink
38 | target\hellofx\bin\launcher
39 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/hellofx.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | 1.0-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | hellofx
38 | launcher
39 | hellofx/org.openjfx.App
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx;
7 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/java/org/openjfx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/java/org/openjfx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/java/org/openjfx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/resources/org/openjfx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/resources/org/openjfx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Modular/Maven/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for IntelliJ
2 |
3 | JavaFX samples to run from IntelliJ with different options and build tools
4 |
5 | Version IntelliJ IDEA 2019.1
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
8 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
9 |
10 | ### Gradle
11 |
12 | Clone the sample, open it with IntelliJ and import the Gradle changes. Build or run
13 | from the Gradle window.
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | }
12 |
13 | javafx {
14 | version = "21"
15 | modules = [ 'javafx.controls', 'javafx.fxml' ]
16 | }
17 |
18 | mainClassName = 'org.openjfx.MainApp'
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/IntelliJ/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hellofx'
2 |
3 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import java.net.URL;
4 | import java.util.ResourceBundle;
5 | import javafx.event.ActionEvent;
6 | import javafx.fxml.FXML;
7 | import javafx.fxml.Initializable;
8 | import javafx.scene.control.Label;
9 |
10 | public class FXMLController implements Initializable {
11 |
12 | @FXML
13 | private Label label;
14 |
15 | @Override
16 | public void initialize(URL url, ResourceBundle rb) {
17 | String javaVersion = System.getProperty("java.version");
18 | String javafxVersion = System.getProperty("javafx.version");
19 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .label {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for IntelliJ
2 |
3 | JavaFX samples to run from IntelliJ with different options and build tools
4 |
5 | Version IntelliJ IDEA 2019.1
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
8 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
9 |
10 | ### Java
11 |
12 | Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
13 | system and unzip to a desired location.
14 |
15 | Clone the sample, open it with IntelliJ, and make sure the paths for JDK and JavaFX match those on your machine.
16 |
17 | Run with `Run -> Edit configurations -> Main`.
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/description.html:
--------------------------------------------------------------------------------
1 | Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
2 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/runConfigurations/Main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/hellofx.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/src/hellofx/Controller.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class Controller {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/src/hellofx/Main.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | public class Main extends Application {
10 |
11 | @Override
12 | public void start(Stage primaryStage) throws Exception{
13 | Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml"));
14 | primaryStage.setTitle("Hello World");
15 | primaryStage.setScene(new Scene(root));
16 | primaryStage.show();
17 | }
18 |
19 |
20 | public static void main(String[] args) {
21 | launch(args);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Java/hellofx/src/hellofx/hellofx.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for IntelliJ
2 |
3 | JavaFX samples to run from IntelliJ with different options and build tools
4 |
5 | Version IntelliJ IDEA 2019.1
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
8 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
9 |
10 | ### Maven
11 |
12 | Clone the sample, open it with IntelliJ and import the Maven changes. Compile or run
13 | from the Maven Projects window.
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | 1.0-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | org.openjfx.App
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(App.class.getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/IntelliJ/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for NetBeans
2 |
3 | JavaFX samples to run from NetBeans with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | The samples assume NetBeans 10 runs on JDK 12 (this can be set editing the `etc/netbeans.conf` file
9 | and setting `netbeans_jdkhome="/path/to/jdk12"`).
10 |
11 | ### Gradle
12 |
13 | For the first time only, install manually the Gradle plugin for NetBeans 2.0.2
14 | from the [GitHub repository](https://github.com/kelemen/netbeans-gradle-project/releases).
15 |
16 | Clone the sample, open it with NetBeans. Select the build.gradle file, and build and run
17 | from the tasks in the Navigator window.
18 |
19 | Run the `jlink` task to create a custom runtime image:
20 |
21 | #### Linux / Mac
22 |
23 | On Linux or Mac run:
24 |
25 | build/image/bin/hellofx
26 |
27 | #### Windows
28 |
29 | On Windows, run:
30 |
31 | build\image\bin\hellofx
32 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | id 'org.beryx.jlink' version '2.26.0'
5 | }
6 |
7 | repositories {
8 | mavenCentral()
9 | }
10 |
11 | javafx {
12 | version = "21"
13 | modules = [ 'javafx.controls', 'javafx.fxml' ]
14 | }
15 |
16 | application {
17 | mainClass = "org.openjfx.MainApp"
18 | mainModule = "hellofx"
19 | }
20 |
21 | jlink {
22 | options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
23 | launcher {
24 | name = 'hellofx'
25 | }
26 | }
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/NetBeans/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hellofx'
2 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx;
7 | }
8 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=624d94cd
2 | build.xml.script.CRC32=c6043d64
3 | build.xml.stylesheet.CRC32=32069288@1.5.1
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=624d94cd
7 | nbproject/build-impl.xml.script.CRC32=ac684799
8 | nbproject/build-impl.xml.stylesheet.CRC32=0f0529df@1.5.1
9 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | do.jlink=true
5 | javac.debug=true
6 | javadoc.preview=true
7 | jlink.strip=false
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2semodule
4 |
5 |
6 | HelloFX
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/src/hellofx/classes/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx;
7 | }
8 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/src/hellofx/classes/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/src/hellofx/classes/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/src/hellofx/classes/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/HelloFX/src/hellofx/classes/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for NetBeans
2 |
3 | JavaFX samples to run from NetBeans with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | Download [JavaFX jmods](https://gluonhq.com/products/javafx/) for your operating
9 | system and unzip to a desired location.
10 |
11 | ### Java
12 |
13 | For the first time only:
14 |
15 | - Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
16 | system and unzip to a desired location.
17 |
18 | - Open NetBeans and create a global Library under `NetBeans -> Tools -> Libraries -> New Library`.
19 | Name it `JavaFXSDK` and include the jars under the lib folder from JavaFX (but not the `src.zip` file).
20 |
21 | - Create a global Library under `NetBeans -> Tools -> Libraries -> New Library`.
22 | Name it `JavaFXMODS` and include the folder JavaFX jmods.
23 |
24 | Clone the sample, open it with NetBeans, and make sure the paths for JDK and JavaFX match those on your machine.
25 |
26 | Clean and build with regular button to create a custom JRE.
27 | Run with regular button.
28 |
29 | To run the custom JRE on Mac:
30 |
31 | dist/jlink/HelloFX/bin/java -m hellofx/org.openjfx.MainApp
32 |
33 | To run the custom JRE on Windows:
34 |
35 | dist\jlink\HelloFX\bin\java -m hellofx/org.openjfx.MainApp
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for NetBeans
2 |
3 | JavaFX samples to run from NetBeans with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | Download [JavaFX jmods](https://gluonhq.com/products/javafx/) for your operating
9 | system and unzip to a desired location.
10 |
11 | ### Maven
12 |
13 | Clone the sample, open it with NetBeans, and make sure the paths for JDK and JavaFX match those on your machine.
14 |
15 | Clean, build and run from the NetBeans usual buttons, or from command line:
16 |
17 | mvn clean javafx:run
18 |
19 | As well, this will work from the terminal on Linux or Mac:
20 |
21 | java --module-path $PATH_TO_FX:target/hellofx-1.0-SNAPSHOT.jar -m hellofx/org.openjfx.MainApp
22 |
23 | or on Windows:
24 |
25 | java --module-path %PATH_TO_FX%:target\hellofx-1.0-SNAPSHOT.jar -m hellofx/org.openjfx.MainApp
26 |
27 | To create and run a custom JRE, from terminal:
28 |
29 | On Linux or Mac run:
30 |
31 | cd IDE/NetBeans/Modular/Maven/hellofx
32 | mvn clean javafx:jlink
33 | target/hellofx/bin/launcher
34 |
35 | On Windows run:
36 |
37 | cd IDE\NetBeans\Modular\Maven\hellofx
38 | mvn clean javafx:jlink
39 | target\hellofx\bin\launcher
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/nbactions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | run
5 |
6 | jar
7 |
8 |
9 | clean
10 | javafx:run
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | HelloFX
6 | 1.0-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | hellofx
38 | launcher
39 | hellofx/org.openjfx.hellofx.App
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 |
5 | opens org.openjfx to javafx.fxml;
6 | exports org.openjfx.hellofx;
7 | }
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/resources/org/openjfx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/resources/org/openjfx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Modular/Maven/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for NetBeans
2 |
3 | JavaFX samples to run from NetBeans with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Gradle
9 |
10 | Clone the sample, open it with NetBeans. Select the build.gradle file, and build and run
11 | from the tasks in the Navigator window.
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | }
12 |
13 | javafx {
14 | version = "21"
15 | modules = [ 'javafx.controls', 'javafx.fxml' ]
16 | }
17 |
18 | mainClassName = 'org.openjfx.MainApp'
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/NetBeans/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'HelloFX'
2 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import java.net.URL;
4 | import java.util.ResourceBundle;
5 | import javafx.fxml.FXML;
6 | import javafx.fxml.Initializable;
7 | import javafx.scene.control.Label;
8 |
9 | public class FXMLController implements Initializable {
10 |
11 | @FXML
12 | private Label label;
13 |
14 | @Override
15 | public void initialize(URL url, ResourceBundle rb) {
16 | String javaVersion = System.getProperty("java.version");
17 | String javafxVersion = System.getProperty("javafx.version");
18 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .label {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for NetBeans
2 |
3 | JavaFX samples to run from NetBeans with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Java
9 |
10 | For the first time only:
11 |
12 | - Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
13 | system and unzip to a desired location.
14 |
15 | - Open NetBeans and create a global Library under `NetBeans -> Tools -> Libraries -> New Library`.
16 | Name it `JavaFXSDK` and include the jars under the lib folder from JavaFX (but not the `src.zip` file).
17 |
18 | Clone the sample, open it with NetBeans, and make sure the paths for JDK and JavaFX match those on your machine.
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=cdca19c3
2 | build.xml.script.CRC32=96549d0d
3 | build.xml.stylesheet.CRC32=f85dc8f2@1.91.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=cdca19c3
7 | nbproject/build-impl.xml.script.CRC32=296bf85c
8 | nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.91.1.48
9 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/Users/JosePereda/Gluon/Gluon-OSS/JavaFX11/jpereda-openjfx-samples/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/project.properties
7 | file:/Users/JosePereda/Gluon/Gluon-OSS/JavaFX11/jpereda-openjfx-samples/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/genfiles.properties
8 | file:/Users/JosePereda/Gluon/Gluon-OSS/JavaFX11/jpereda-openjfx-samples/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/project.xml
9 | file:/Users/JosePereda/Gluon/Gluon-OSS/JavaFX11/jpereda-openjfx-samples/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/build-impl.xml
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | HelloFX
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/src/hellofx/Controller.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class Controller {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/src/hellofx/Main.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | public class Main extends Application {
10 |
11 | @Override
12 | public void start(Stage primaryStage) throws Exception{
13 | Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml"));
14 | primaryStage.setTitle("Hello World");
15 | primaryStage.setScene(new Scene(root));
16 | primaryStage.show();
17 | }
18 |
19 |
20 | public static void main(String[] args) {
21 | launch(args);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Java/hellofx/src/hellofx/hellofx.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for NetBeans
2 |
3 | JavaFX samples to run from NetBeans with different options and build tools.
4 |
5 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system.
6 | Make sure `JAVA_HOME` is properly set to the JDK installation directory.
7 |
8 | ### Maven
9 |
10 | Clone the sample, open it with NetBeans and reload the POM. Clean, build and run
11 | from the NetBeans usual buttons.
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/nbactions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | run
5 |
6 | jar
7 |
8 |
9 | clean
10 | javafx:run
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | HelloFX
6 | 1.0-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | org.openjfx.hellofx.App
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/NetBeans/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-font-weight: bold;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for Visual Studio Code
2 |
3 | JavaFX 17 samples to run from Visual Studio Code with different options and build tools.
4 |
5 | Version Visual Studio Code: 1.63.0 or higher.
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system. Make sure `JAVA_HOME` is properly set to the JDK installation directory.
8 |
9 | ### Gradle
10 |
11 | For the first time only:
12 |
13 | - Make sure you have installed following extensions in your Visual Studio Code:
14 | - [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack)
15 | - [Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle)
16 |
17 | - Clone the sample, open the folder `hellofx` in Visual Studio Code.
18 |
19 | To run the JavaFX application, you can open the `Gradle Projects` explorer, expand `hellofx` > `Tasks` > `application` and run the Gradle task: `run`.
20 |
21 | 
22 |
23 | Or alternatively run from terminal:
24 |
25 | On Linux or Mac run:
26 |
27 | cd IDE/VSCode/Modular/Gradle/hellofx
28 | ./gradlew run
29 |
30 | On Windows run:
31 |
32 | cd IDE\VSCode\Modular\Gradle\hellofx
33 | .\gradlew.bat run
34 |
35 | #### Custom Runtime
36 |
37 | To create and run a custom JRE, you can open the `Gradle Projects` explorer, expand `hellofx` > `Tasks` > `build` and run the Gradle task: `jlink`. The executable file will be generated at `build/image/bin/hellofx` (Or `build\image\bin\hellofx.bat` on Windows).
38 |
39 | Or alternatively run from terminal:
40 |
41 | On Linux or Mac run:
42 |
43 | cd IDE/VSCode/Modular/Gradle/hellofx
44 | ./gradlew jlink
45 | build/image/bin/hellofx
46 |
47 | On Windows run:
48 |
49 | cd IDE\VSCode\Modular\Gradle\hellofx
50 | .\gradlew.bat jlink
51 | build\image\bin\hellofx.bat
52 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | id 'org.beryx.jlink' version '2.24.4'
5 | }
6 |
7 | repositories {
8 | mavenCentral()
9 | }
10 |
11 | javafx {
12 | version = "21"
13 | modules = [ 'javafx.controls', 'javafx.fxml' ]
14 | }
15 |
16 | application {
17 | mainClass = "org.openjfx.MainApp"
18 | mainModule = "hellofx"
19 | }
20 |
21 | jlink {
22 | options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
23 | launcher {
24 | name = 'hellofx'
25 | }
26 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/gradle.properties:
--------------------------------------------------------------------------------
1 | ## if JAVA_HOME is not JDK, set and uncomment:
2 | #org.gradle.java.home=/path/to/jdk/
3 |
4 |
5 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/VSCode/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hellofx'
2 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 | requires transitive javafx.graphics;
5 |
6 | opens org.openjfx to javafx.fxml;
7 | exports org.openjfx;
8 | }
9 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .label {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Gradle/run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/VSCode/Modular/Gradle/run.png
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Modular samples for Visual Studio Code
2 |
3 | JavaFX 17 samples to run from Visual Studio Code with different options and build tools.
4 |
5 | Version Visual Studio Code: 1.63.0 or higher.
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system. Make sure `JAVA_HOME` is properly set to the JDK installation directory.
8 |
9 | ### Maven
10 |
11 | For the first time only:
12 |
13 | - Make sure you have the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) installed in your Visual Studio Code.
14 |
15 | - Clone the sample, open the folder `hellofx` in Visual Studio Code.
16 |
17 | #### Run the JavaFX Application
18 |
19 | To run the JavaFX application, you can open the `Maven` explorer, expand `hellofx` > `Plugins` > `javafx` and run the Maven goal: `javafx:run`.
20 |
21 | 
22 |
23 | Or alternatively run from terminal: `mvn javafx:run`
24 |
25 | #### Custom Runtime
26 |
27 | To create and run a custom JRE, you can open the `Maven` explorer, expand `hellofx` > `Plugins` > `javafx` and run the Maven goal: `javafx:jlink`. The executable file will be generated at `target/hellofx/bin/launcher` (Or `target\hellofx\bin\launcher.bat` on Windows).
28 |
29 | Or alternatively run from terminal:
30 |
31 | On Linux or Mac run:
32 |
33 | cd IDE/VSCode/Modular/Maven/hellofx
34 | mvn clean javafx:jlink
35 | target/hellofx/bin/launcher
36 |
37 | On Windows run:
38 |
39 | cd IDE\VSCode\Modular\Maven\hellofx
40 | mvn clean javafx:jlink
41 | target\hellofx\bin\launcher.bat
42 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | 0.0.1-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | hellofx
38 | launcher
39 | hellofx/org.openjfx.hellofx.App
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | module hellofx {
2 | requires javafx.controls;
3 | requires javafx.fxml;
4 | requires transitive javafx.graphics;
5 |
6 | opens org.openjfx.hellofx to javafx.fxml;
7 | exports org.openjfx.hellofx;
8 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/VSCode/Modular/Maven/run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/VSCode/Modular/Maven/run.png
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for Visual Studio Code
2 |
3 | JavaFX 17 samples to run from Visual Studio Code with different options and build tools.
4 |
5 | Version Visual Studio Code: 1.63.0 or higher.
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system. Make sure `JAVA_HOME` is properly set to the JDK installation directory.
8 |
9 | ### Gradle
10 |
11 | For the first time only:
12 |
13 | - Make sure you have installed following extensions in your Visual Studio Code:
14 | - [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack)
15 | - [Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle)
16 |
17 | - Clone the sample, open the folder `hellofx` in Visual Studio Code.
18 |
19 | To run the JavaFX application, you can open the `Gradle Projects` explorer, expand `hellofx` > `Tasks` > `application` and run the Gradle task: `run`
20 |
21 | 
22 |
23 | Or alternatively run from terminal:
24 |
25 | On Linux or Mac run:
26 |
27 | cd IDE/VSCode/Non-Modular/Gradle/hellofx
28 | ./gradlew run
29 |
30 | On Windows run:
31 |
32 | cd IDE\VSCode\Non-Modular\Gradle\hellofx
33 | .\gradlew.bat run
34 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'application'
3 | id 'org.openjfx.javafxplugin' version '0.1.0'
4 | }
5 |
6 | repositories {
7 | mavenCentral()
8 | }
9 |
10 | javafx {
11 | version = "21"
12 | modules = [ 'javafx.controls', 'javafx.fxml' ]
13 | }
14 |
15 | application {
16 | mainClass = 'org.openjfx.MainApp'
17 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/gradle.properties:
--------------------------------------------------------------------------------
1 | ## if JAVA_HOME is not JDK, set and uncomment:
2 | #org.gradle.java.home=/path/to/jdk/
3 |
4 |
5 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/VSCode/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | *
6 | * Detailed information about configuring a multi-project build in Gradle can be found
7 | * in the user guide at https://docs.gradle.org/4.10.2/userguide/multi_project_builds.html
8 | */
9 |
10 | rootProject.name = 'hellofx'
11 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/FXMLController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class FXMLController {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/src/main/java/org/openjfx/MainApp.java:
--------------------------------------------------------------------------------
1 | package org.openjfx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 |
10 | public class MainApp extends Application {
11 |
12 | @Override
13 | public void start(Stage stage) throws Exception {
14 | Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
15 |
16 | Scene scene = new Scene(root);
17 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
18 |
19 | stage.setTitle("JavaFX and Gradle");
20 | stage.setScene(scene);
21 | stage.show();
22 | }
23 |
24 | public static void main(String[] args) {
25 | launch(args);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/scene.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/hellofx/src/main/resources/org/openjfx/styles.css:
--------------------------------------------------------------------------------
1 | .label {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Gradle/run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/VSCode/Non-Modular/Gradle/run.png
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Java/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for Visual Studio Code
2 |
3 | JavaFX 17 samples to run from Visual Studio Code with different options and build tools.
4 |
5 | Version Visual Studio Code: 1.63.0 or higher.
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system. Make sure `JAVA_HOME` is properly set to the JDK installation directory.
8 |
9 | ### Java
10 |
11 | For the first time only:
12 |
13 | - Download [JavaFX SDK](https://gluonhq.com/products/javafx/) for your operating
14 | system and unzip to a desired location.
15 |
16 | - Make sure you have the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) installed in your Visual Studio Code.
17 |
18 | - Clone the sample, open the folder `hellofx` in Visual Studio Code. Open any of the Java file to import the project.
19 |
20 | - Open `.vscode/settings.json`, replace the `` to you JavaFX lib folder.
21 |
22 | - Open `.vscode/launch.json`, replace the `` to you JavaFX lib folder.
23 |
24 | #### Run the JavaFX Application
25 |
26 | To run the JavaFX Application, open left side `Run and Debug` panel -> `Launch App`.
27 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Java/hellofx/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "java",
9 | "name": "Launch App",
10 | "request": "launch",
11 | "mainClass": "hellofx.Main",
12 | "vmArgs": "--module-path --add-modules javafx.controls,javafx.fxml",
13 | }
14 | ]
15 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Java/hellofx/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.project.sourcePaths": ["src"],
3 | "java.project.outputPath": "bin",
4 | "java.project.referencedLibraries": [
5 | "/**/*.jar",
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Java/hellofx/src/hellofx/Controller.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.fxml.FXML;
4 | import javafx.scene.control.Label;
5 |
6 | public class Controller {
7 |
8 | @FXML
9 | private Label label;
10 |
11 | public void initialize() {
12 | String javaVersion = System.getProperty("java.version");
13 | String javafxVersion = System.getProperty("javafx.version");
14 | label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Java/hellofx/src/hellofx/Main.java:
--------------------------------------------------------------------------------
1 | package hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | public class Main extends Application {
10 |
11 | @Override
12 | public void start(Stage primaryStage) throws Exception{
13 | Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml"));
14 | primaryStage.setTitle("Hello World");
15 | primaryStage.setScene(new Scene(root, 400, 300));
16 | primaryStage.show();
17 | }
18 |
19 |
20 | public static void main(String[] args) {
21 | launch(args);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Java/hellofx/src/hellofx/hellofx.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/README.md:
--------------------------------------------------------------------------------
1 | ## Non-modular samples for Visual Studio Code
2 |
3 | JavaFX 17 samples to run from Visual Studio Code with different options and build tools.
4 |
5 | Version Visual Studio Code: 1.63.0 or higher.
6 |
7 | Download [JDK 17 or later](http://jdk.java.net/) for your operating system. Make sure `JAVA_HOME` is properly set to the JDK installation directory.
8 |
9 | ### Maven
10 |
11 | For the first time only:
12 |
13 | - Make sure you have the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) installed in your Visual Studio Code.
14 |
15 | - Clone the sample, open the folder `hellofx` in Visual Studio Code.
16 |
17 | #### Run the JavaFX Application
18 |
19 | To run the JavaFX application, you can open the `Maven` explorer, expand `hellofx` > `Plugins` > `javafx` and run the Maven goal: `javafx:run`
20 |
21 | 
22 |
23 | Or alternatively run from terminal: `mvn javafx:run`
24 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.openjfx
5 | hellofx
6 | 1.0-SNAPSHOT
7 |
8 | UTF-8
9 | 17
10 | 21
11 | 0.0.8
12 |
13 |
14 |
15 | org.openjfx
16 | javafx-controls
17 | ${javafx.version}
18 |
19 |
20 | org.openjfx
21 | javafx-fxml
22 | ${javafx.version}
23 |
24 |
25 |
26 |
27 |
28 | org.apache.maven.plugins
29 | maven-compiler-plugin
30 | 3.11.0
31 |
32 |
33 | org.openjfx
34 | javafx-maven-plugin
35 | ${javafx.maven.plugin.version}
36 |
37 | org.openjfx.hellofx.App
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/App.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import javafx.application.Application;
4 | import javafx.fxml.FXMLLoader;
5 | import javafx.scene.Parent;
6 | import javafx.scene.Scene;
7 | import javafx.stage.Stage;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * JavaFX App
13 | */
14 | public class App extends Application {
15 |
16 | private static Scene scene;
17 |
18 | @Override
19 | public void start(Stage stage) throws IOException {
20 | scene = new Scene(loadFXML("primary"));
21 | scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
22 | stage.setScene(scene);
23 | stage.show();
24 | }
25 |
26 | static void setRoot(String fxml) throws IOException {
27 | scene.setRoot(loadFXML(fxml));
28 | }
29 |
30 | private static Parent loadFXML(String fxml) throws IOException {
31 | FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
32 | return fxmlLoader.load();
33 | }
34 |
35 | public static void main(String[] args) {
36 | launch();
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/PrimaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class PrimaryController {
7 |
8 | @FXML
9 | private void switchToSecondary() throws IOException {
10 | App.setRoot("secondary");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/src/main/java/org/openjfx/hellofx/SecondaryController.java:
--------------------------------------------------------------------------------
1 | package org.openjfx.hellofx;
2 |
3 | import java.io.IOException;
4 | import javafx.fxml.FXML;
5 |
6 | public class SecondaryController {
7 |
8 | @FXML
9 | private void switchToPrimary() throws IOException {
10 | App.setRoot("primary");
11 | }
12 | }
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/primary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/secondary.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/hellofx/src/main/resources/org/openjfx/hellofx/styles.css:
--------------------------------------------------------------------------------
1 | .button {
2 | -fx-text-fill: blue;
3 | }
4 |
--------------------------------------------------------------------------------
/IDE/VSCode/Non-Modular/Maven/run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openjfx/samples/605de7f9fac6b595f787c9d718aa6e523aa1b24f/IDE/VSCode/Non-Modular/Maven/run.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2019, Gluon
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | org.openjfx
6 | samples
7 | pom
8 | 1.0-SNAPSHOT
9 |
10 | samples
11 |
12 |
13 |
--------------------------------------------------------------------------------