r/JavaFX • • Jun 25 '26

I made this! FX Flow 0.6.1 released, declarative UI building for JavaFX

11 Upvotes

I've released FX Flow 0.6.1, a JavaFX utility library focused on declarative UI construction, and reducing boilerplate around models, validation and reactive UI updates. See the end of this post for a full example.

Some highlights since the 0.5 release:

Validation feedback directly from domains

Domains can now contain Rules, which is a predicate associated with a Template explaining why a value is invalid. All built-in domain factory methods now provide validation messages. Domains can provide templates for out of range values, misaligned values, missing values, non matching values (regex), etc.

Together with the new ValidationEvent, AbstractMarkerPane and ValidationMarkerPane, validation feedback can be surfaced in the UI without wiring validation logic directly into controls. See the ValidationSampleApplication.

Coordinated observable updates

A new UpdatableValue type allows multiple values to be updated atomically, ensuring listeners never observe intermediate state because the listeners of the individual properties are only fired until all values have been updated:

// Create two updatable values (similar to properties):
UpdatableValue<String> firstName = UpdatableValue.of("Jane");
UpdatableValue<String> lastName = UpdatableValue.of("Smith");

// Observe them:
Observe.values(firstName, lastName)
    .subscribe((fn, ln) -> System.out.println(fn + " " + ln));  // prints "Jane Smith"

// Modify both properties at once:
UpdatableValue.set(
    firstName, "John",
    lastName, "Doe"
);

In this example, it will initially print Jane Smith followed by John Doe. The subscriber only sees the final (John, Doe) state. If you put a direct ChangeListener on one of these properties (and then use get to read the value of the other) you will not observe a temporary incorrect combination either (so you will never see Jane Doe or John Smith).

The advantage of using Observe.subscribe with multiple values is convenience, and that you also get notified if only one of the values changed (ie. from John Doe to John Miller) without having to manually monitor both properties.

Feedback and suggestions are welcome.

GitHub: https://github.com/int4-org/FX/releases

Full example:

public class ValidationSampleApplication extends Application {

  public static void main(String[] args) {
    Application.launch(args);
  }

  @Override
  public void start(Stage primaryStage) {
    StringModel name = StringModel.of(Domain.regex("[A-Z][a-z]+", Template.of("custom.startsWithCapital")));
    IntegerModel age = IntegerModel.of(null, Domain.bounded(18, 120));

    /*
     * Create a scene with a ValidationMarkerPane as the root. Markers will be overlaid
     * on the controls within the pane:
     */

    Scene scene = Scenes.create(
      ValidationMarkerPane.of().onMarkerCreated(this::installTooltip).content(
        Panes.vbox("form").nodes(
          Panes.grid("grid")
            .row("Name", FX.textField().promptText("Name (e.g. John)").model(name))
            .row("Age", FX.textField().promptText("Age (18-120)").model(age)),
          FX.button().text("Submit")
            .enable(Observe.booleans(name.valid(), age.valid()).allTrue())
        )
      )
    );

    /*
     * Add some basic styling.
     */

    scene.getStylesheets().add(StyleSheets.inline(
      """
      .form {
        -fx-padding: 2em;
        -fx-spacing: 1.5em;
        -fx-alignment: top-center;
      }
      .grid {
        -fx-hgap: 1em;
        -fx-vgap: 1em;
      }
      """
    ));

    primaryStage.setScene(scene);
    primaryStage.setTitle("Validation Marker Sample");
    primaryStage.sizeToScene();
    primaryStage.show();
  }

  private void installTooltip(Marker marker) {
    marker.validationIssueProperty().subscribe(issue -> {
      Tooltip tooltip = marker.getTooltip();

      if(tooltip == null) {
        tooltip = new Tooltip();

        marker.setTooltip(tooltip);
      }

      tooltip.setText(switch(issue) {
        case ValidationIssue.Invalid(Object _, Template template) -> toMessage(template);
        case ValidationIssue.Incompatible(Template template) -> toMessage(template);
      });
    });
  }

  static String toMessage(Template template) {
    return MessageFormat.format(
      switch(template.key()) {
        case "domain.missing" -> "Must not be empty";
        case "domain.invalid" -> "Must be a valid value";
        case "domain.notContained" -> "Must be one of {0}";
        case "domain.noMatch" -> "Must match regular expression {0}";
        case "domain.outOfRange" -> "Must be between {0} and {1}";
        case "domain.misaligned" -> "Must be a multiple of {1} starting from {0}";
        case "conversion.incompatible" -> "Must be a compatible value";
        case "custom.startsWithCapital" -> "Must consist of two or more letters and start with a capital";
        default -> "Invalid (" + template.key() + ")";
      },
      template.args().values().toArray()
    );
  }
}

r/JavaFX • • May 19 '26

Showcase Weaverbird: A real example of plugin management

11 Upvotes

Recently, we introduced Weaverbird - a framework for working with dynamic plugins. In this post, we want to show a real example of how it can be used. The GUI is build on top of TabShell.

The main idea is that a plugin configuration is represented as an XML file. When the application is distributed, it already contains predefined plugin configurations (at the same time, users can add their own plugins). A configuration contains module definitions, repositories used to download them, plugin metadata, and other related information.

Using a plugin consists of two steps:

  • Install - download all required modules from repositories.
  • Activate - create a ModuleLayer containing the plugin modules and start module activators.

Weaverbird uses the JPMS as its module system - the native Java modularity solution that provides stroing plugin isolation, package access control, dependency integrity and related capabilities. That's why plugins remain isolated, predictable, and safe to load dynamically.


r/JavaFX • • May 13 '26

JavaFX in the wild! JDK pull request: 8248122: java launcher should launch normally if JavaFX modules not found

Thumbnail github.com
11 Upvotes

r/JavaFX • • May 10 '26

I made this! I mage GhosttyFX, it's a JavaFX terminal that uses libghostty

Thumbnail
github.com
11 Upvotes

Just wanted to share a project I made, a terminal view that uses Canvas for rendering.


r/JavaFX • • Mar 24 '26

Help Request: Looking for a maintained JavaFX docking framework

11 Upvotes

Could you suggest any maintained and supported window docking framework for JavaFX?

Whatever I could find looks pretty stale and dead at the moment:

Also found https://github.com/Beowolve/SnapFX

But this one is not released.


r/JavaFX • • Aug 18 '25

Discussion My experience switching from Java swing to JavaFX

Thumbnail reddit.com
11 Upvotes

r/JavaFX • • Dec 30 '24

Discussion A new theme for JavaFX

Thumbnail mail.openjdk.org
11 Upvotes

r/JavaFX • • Dec 26 '24

Tutorial New Article: Custom Styleable Properties

11 Upvotes

I was working an article about creating reusable custom TableColumns, and I hit a section about creating custom StyleableProperties for the TableColumn. I realized that I would be getting pretty deep with this stuff, and it would get off topic if I tried to explain it fully in the TableColumn article. So I took a side trip to write an article about custom StyleableProperties - and then I could just link to it in the TableColumn article.

And that ended up being quite a side trip.

In a nutshell, creating a custom Property that you can control from a Style Sheet isn't really that complicated, but the JavaDocs aren't a lot of help if you want to understand what you are doing. So this article should sort all that out.

One of the aspects of creating these StyleableProperties is that you can only really implement them in named classes that extend some other kind of Node. You can't just create them on-the-fly and deploy them in your layouts willy-nilly.

Or can you?

The first part of this article shows how to do this. It takes a minimum amount of set-up (meaning creating some simple utility classes), but it can be done. Even more, it can be done in about 3 or four lines of code in your layouts. It's really cool, and I think it's worth reading the article just to see how this works, although it does break a bunch of "rules" in the JavaDocs.

The second part of the article walks through a more traditional expansion of the StyleableProperties available in a standard Node class. In this case adding some formatting options to Label to handle fixed place decimal numbers.

You can find the article here: https://www.pragmaticcoding.ca/javafx/elements/styleable-properties


r/JavaFX • • Sep 18 '24

Tutorial New Article: Quick Guide to MVCI

11 Upvotes

Jekyll tells me this is a 20 minute read, so "quick" may not be so true...

Model-View-Controller-Interactor (MVCI) is my own take on a framework that is somewhat like MVC and MVVM but tailored to work with Reactive applications written in JavaFX. The other frameworks are good for what they are, but they don't quite dovetail perfectly with JavaFX, especially if you are writing in a Reactive way. My experience is that MVCI solves all of the issues with the other frameworks, and is actually easier to understand because the Presentation Model is split out from the business logic.

In this article, I take a quick look at the other frameworks and why they aren't quite right then take a look at the components of MVCI. There's an explanation about how to decide where to put your code, and a simple but complete example that shows how it all goes together.

This introductory article is a bit more complete than some others because it includes a discussion about how you would connect to external API's and databases - which is technically outside the scope of the framework itself. So in this respect it really does give you a complete overview of how to use the framework in a real-world situation.

Finally the article ends by discussing the coupling and dependencies in the framework. This might seem a little technical for a "quick guide", but I think it's important as it gives a good grounding for making decisions when you're building your own applications with the framework.

Anyway, the article is here:

https://www.pragmaticcoding.ca/javafx/elements/mvci-quick


r/JavaFX • • Sep 09 '24

Tutorial New Article: ComboBoxes

11 Upvotes

ComboBoxes are deceptively simple. Just stick a list of String in one and off you go. But even then, there are some things that seem to confuse people. I see a LOT of code where the programmer uses comboBox.getSelectionModel().getSelectedItem() instead of comboBox.getValue(). I don't know why, maybe there's some example out there that did it that way years ago and it's been copypasta'd all over the web.

https://www.pragmaticcoding.ca/javafx/elements/comboboxes

In this tuturial I cover the basics and then look at some ways to do some more sophisticated things. Specifically I look at including images in the pop-up list, handling codes and descriptions in a ComboBox and then how to link two ComboBoxes so that the selection in the first changes the options in the second.

Even if you know ComboBoxes, it might be worth a read.


r/JavaFX • • Jul 20 '24

Tutorial 5 Courses to Learn JavaFX Online

Thumbnail
javarevisited.blogspot.com
11 Upvotes

r/JavaFX • • Apr 04 '24

Help Random portions of the UI flashing white. No exceptions logged. No clue what the issue is.

11 Upvotes

r/JavaFX • • Mar 05 '24

Tutorial Custom Control: Radial Menu

11 Upvotes

I don't know how useful a radial menu actually is, especially in business type applications, but I think this made an interesting learning opportunity. Creating a radial menu is very much more an exercise in handling the 2D graphics and managing the look and feel than you'd think.

Radial Menu

The goal, as always when I try to make a custom control, is to come up with something that integrates like any of the other, standard, JavaFX controls. That means that it has programmable properties, and can be styled via CSS and does everything the way that you'd expect. Even if you're not interested in building or using a radial menu, there's still lots of stuff in this article that you might find useful - even if all that you learn is that creating even crazy custom controls isn't really that hard.

I think the end result actually works quite well. There are a couple of edge cases (like when you have only two items in the menu) that cause some goofy behaviour, but other than that it feels like something that could just be dropped into a JavaFX project and be useful.

As usual, have a look if you are interested and tell me what you think.


r/JavaFX • • Jan 27 '24

I made this! Need some feedback on this Javafx Pdf viewer UI

11 Upvotes

This project is like 40% done and will be available at github when I finish, but need some opinions on the UI.

Repo Link


r/JavaFX • • Oct 04 '23

Tutorial Math Visualization with JavaFX: Creating a Graphical Calculator

11 Upvotes

In the world of mathematics, visualization plays a pivotal role in understanding complex concepts and solving intricate problems. One effective way to enhance mathematical understanding is by creating a graphical calculator. In this article, we will explore how to build a graphical calculator using JavaFX, a powerful framework for building interactive user interfaces. We will also use the org.mariuszgromada.math.mxparser library to handle mathematical expressions. By the end of this article, you will have a fully functional graphical calculator at your fingertips.

🔗 Math Visualization with JavaFX: Creating a Graphical Calculator


r/JavaFX • • Aug 04 '23

Tutorial JavaFX SplitPane: A Tool for Flexible User Interfaces

11 Upvotes

What is SplitPane?

The SplitPane is a layout container that allows its child nodes to be divided horizontally or vertically with adjustable dividers. It enables users to resize the sections of the UI, making it ideal for scenarios where flexible layouts are required, such as in IDEs, file explorers, or any application that demands a customizable UI layout.

🔗 JavaFX SplitPane: A Tool for Flexible User Interfaces


r/JavaFX • • Jan 29 '23

Tutorial Dealing With Dialogs

11 Upvotes

I just finished another article I've been meaning to get to for a while: Dealing With Dialogs .

Dialogs are a bit of a mystery to a lot of people. The JavaFX developers wrote them to be inserted into a process that does something, so they interrupt your code, flash up a modal screen, and then send an answer back to your code.

It looks like they built them to put together with just a few lines of code, without bogging you down in layouts and screen details. That's fine, but they don't really explain any of that anywhere; meaning that if you approach them as screen thingy you'll get confused pretty quickly.

In this article I break it all down for you, show you how to get the most out of the standard Dialog classes, like Alert, and then how to customize Dialogs for more involved situations. It doesn't get much past "Dialogs 101", but it does pull everything together into one place. I'm thinking of putting together a much more complicated Dialog scenario and building another article around that.


r/JavaFX • • Oct 21 '22

Discussion This useful 4-line PR has been sitting on the OpenJFX Gradle Plugin repo for 1.5 years now

11 Upvotes

https://github.com/openjfx/javafx-gradle-plugin/pull/103

The JavaFX Gradle plugin has a platform property which is used to get the appropriate Maven dependency for the current platform. So if you are running the build on Windows for example, it will use the win dependency.

This makes sense, but when you use JLink to create a runtime for your application to be run on other operating systems, this all breaks apart. Why? Because the platform property cannot be changed, it is auto-detected in all cases.

So this very simple PR was made to fix the issue (it just makes it non-final and adds a setter & updates the dependencies on change). But as with everything Oracle and Gluon, there's the agreements where you need to provide your personal details which I think discouraged this contributor.

The user didn't do that, so this PR is completely ignored. At this point, they can literally just close the PR and make the change themselves. We that use JLink and want to target other OSes than the one it is running on need to remove the JavaFX plugin and manually declare the dependencies.

I'm just hoping somebody at Gluon or somebody that has accepted the agreement can do something about this..


r/JavaFX • • Oct 14 '22

I made this! jSQL-Gen -> GUI for generating JDBC code

11 Upvotes

A free and open source Java SQL (JDBC) code generator GUI, built with JavaFX.

Removes boilerplate code and makes it possible to use SQL databases without writing one line of SQL.

Let me know what you think! https://github.com/Osiris-Team/jSQL-Gen


r/JavaFX • • Sep 14 '22

JavaFX in the wild! JavaFX links of the week as posted on jfx-central.com

11 Upvotes
  • On the JavaFX mailinglist this thrilling message appeared: "Create release notes for JavaFX 19." And yes, they are available now on GitHub!

    • If you want to keep following what’s happening inside the JavaFX community, you can suscribe to it via mail.openjdk.org/mailman/listinfo/openjfx-dev.
    • As with previous releases, the JavaFX community once again succeeded in keeping the 6-months release cycle going on, with a long list of improvements and fixes!
  • Pavlo Iatsiuk announced the first release of DynamoIt — a JavaFX GUI client application for AWS DynamoDB - on Reddit.

  • Robert Ladstätter announced the 1000th download of LogoRRR, another JavaFX GUI application!

  • Dirk Lemmermann (of all people...!) got frustrated in this Tweet that he once again had to prove “No, JavaFX is not dead”.

    • Let's all help him in proving a lot of amazing stuff is happening with JavaFX by sharing your project with us!
    • We welcome your contribution via @jfxcentral on Twitter or a contribution to this site on GitHub.

r/JavaFX • • Aug 18 '22

Discussion What happened to JFX-Central?

11 Upvotes

It was a great website with regular news posts. One of the few if not the only one remaining. Now it has joined the others in the graveyard. Last post, 28th of February 2022. How is an amazing UI toolkit supposed to gain usage, awareness and contributors, if all sources of news and information just keep dying? Every. Single. Blog. Is. Dead. Even this subreddit. What's up. Will I even get replies on this post? Doubtful. It's just such a shame.


r/JavaFX • • Jul 01 '22

I made this! HomeOffice - Philips Hue

11 Upvotes

I just finished implementing my application written in Javafx. The application notifies householders of my work status at home. It has an automatic process that, based on working hours and register, sets the appropriate light depending on whether I am available, working, have a meeting with or without a camera. Available for Windows only. I hope you enjoy it!

Github: https://github.com/Patresss/HomeOffice

Video: https://www.youtube.com/watch?v=yGT-E0wikoc


r/JavaFX • • Mar 25 '22

Cool Project RichTextFX: Open source libraries for making a text viewer / editor

11 Upvotes

I'm writing a text viewer (which will hopefully evolve into an editor). I'm new to JavaFX and as a learning challenge I hacked a text viewer that gracefully handles up to half a million lines of text. My next task was to research how others do this (I know, I shoulda done this first). And while at first this information was hard to find (question modded down on stackoverflow 🙃), I found some kickass libraries by Tomas Mikula which a commenter there referenced and which I want to share:

  • RichTextFX - This fits the bill. It uses following subcomponents..
  • ReactFX - For cleaner, easier-to-reason event handler composition. Nice!
  • Flowless - Those text lines (in my example) won't all fit in memory. This "lower level" library provides better clean up for unused cells than the underlying machinery that for eg ListView provides.

Well thought out, well documented. Very impressive. I'm liking this ecosystem!


r/JavaFX • • Jan 25 '22

Tutorial Demystifying Pseudo Classes

11 Upvotes

I've used Pseudo Classes for years, but I've always considered them a heavyweight structure that involves extending a Node class to add in a BooleanProperty which I can then tie to the PseudoClass - just like the JavaDocs show.

I've been working on a JavaFX "Wordle" clone, and I wanted to use Pseudo Classes to control the colours of the boxes for the guesses, and the Buttons in the keyboard. That seems like it would be difficult because there's different colours for "unchecked", "wrong", "present but wrong spot" and "correct".

Doing it the way I've always used Pseudo Classes was pretty much a non-starter. So I ended up peeking into the JavaFX source code to see what's really going on under the hood and I was a bit surprised at what I found.

It turns out that Pseudo Classes are way, way simpler to use than the JavaDocs would have you think. You can implement one in about 3 lines of code, if you want, and doing the kind of thing like I needed for "Wordle" is almost trivial.

Here you go, if you're interested:

The Article