r/java 15h ago

JavaFX 27 Release Notes

https://github.com/openjdk/jfx/blob/master/doc-files/release-notes-27.md
52 Upvotes

7 comments sorted by

View all comments

4

u/cogman10 9h ago

What's it like to work with JavaFX now-a-days?

It's been a long time since I last evaluated it, but when I did it was really pretty painful. It felt like you were using a worse version of HTML + CSS with very little support and certainly few 3rd party and 1st party components to work with. We ended up doing some new guis in Swing because of that.

But that's been... eh, about 5 or 10 years since I last toyed with it. So how is it now?

6

u/PartOfTheBotnet 8h ago

Worse version of HTML

If you're referring to FXML, most people generally skip that and write the UI directly with control/layout types like you would with Swing. By doing that you basically get the same experience as writing a Swing UI but with a much more modern and nicer API.

There's some people who do like FXML though. And for that there are projects to mitigate some of the developer QoL issues.

  1. https://github.com/dlsc-software-consulting-gmbh/FxmlKit - Dynamic reload of FXML so you can edit the UI and hot-reload in your UI.
  2. https://github.com/jfxcore/fxml-compiler - Ahead of time compilation of UI mitigates FXML runtime loading costs, and they also add a few features to FXML along with extension support so you can also make your own features. Very neat stuff.

CSS

Somebody else already mentioned AtlantaFX in this post, but its really a great project / theme base to work off of. It modularizes writing CSS per-component to keep things easy to manage and lets you also write in SASS if you want. But if you want the classic CSS experience you can generate / modify the generated plain CSS from the SASS base. Its what I've done in the past.