This week we're doing a Live Stream on JavaFX, and I wanted to use that opportunity to refresh my JavaFX knowledge.
I wanted to investigate two areas in particular:
- How do the changes in Java 11 (when JavaFX was moved out of the JDK) impact JavaFX applications?
- How do I get a modern (Java 15) JavaFX application working as expected in IntelliJ IDEA (using either Maven or Gradle as the build tool)?
I now have six different applications that showcase JavaFX! And... they all have slightly different issues... sorry, I mean "subtleties around the best way to run them". Yes.
If you're interested in writing JavaFX, you might just want to dive straight into the code:
- javafx-gradle: this uses Java modules, which may come with its own complications, but it's the best-working approach I found to creating a Gradle JavaFX application. It's an implementation of the "Modular with Gradle" sample JavaFX application from the OpenJFX Getting Stated Documentation. More details
- javafx-gradle-simple: an implementation of the "Non-modular with Gradle" sample JavaFX application from the OpenJFX Documentation. More details
- javafx-maven-via-archetype: uses this JavaFX Maven archetype and is a Modular application, or you can check out the without-modules branch. More details
- jb-stock-client: the JavaFX UI (and client connection module) for the Reactive Spring Boot tutorial that I created with help from Josh Long. JavaFX (15.0.1), Maven, Spring Boot (2.4.1), no Java modules.
- sense: my (now quite old) Java 8 demo application. JavaFX (15.0.1), Gradle (6.8), no Java modules. Blog post
- sense-nine: an update to the Java 8 application "sense" to demo Java 9 modularity. JavaFX (15.0.1), Gradle (6.8), Java modules. Blog post
If you're actually writing JavaFX applications, you might be even more interested in the "interesting" edge cases, caveats, and workarounds, which I will cover in upcoming blog posts, along with (where appropriate) the steps I took to upgrade the applications. You might also be interested in the more general post I wrote for the IntelliJ IDEA Blog about the best way to create and run JavaFX applications in IntelliJ IDEA
Inspired by our upcoming Live Stream, I finally got around to creating two simple #JavaFX projects that run on @intellijidea with #JDK15.
- Maven: https://t.co/FBk3frZd6d
- Gradle: https://t.co/Uy6ettK1JJThese are based off https://t.co/hqBnv6eDyEhttps://t.co/QBEiGWdOM6
— Trisha Gee (@trisha_gee) January 11, 2021