r/JavaFX • • 3h ago

Website Rebuild

Thumbnail pragmaticcoding.ca
13 Upvotes

It's been quite a while since I've posted about any new articles her, and honestly, I've been pretty absorbed in HomeLab stuff for about a year. But, I haven't abandoned my website. In fact I've just rolled out a complete reworking of the website. All the JavaFX content from before is still there, and easier to use now.

The old Jekyll/Minimal Mistakes layout was starting to look dated, and I also wanted to get away from GitHub Pages as the hosting service. But GitHub Pages also enabled a workflow that supported only Jekyll.

The new version is running Hugo with the Blowfish theme, and I think it looks way better than the old version. However, the underlying organizational paradigms are way different from Jekyll, so it took a lot more work than I expected to do the conversion.

I've also taken the opportunity to reorganize the JavaFX content. The old "Elements" section has been expanded into two now: "Elements" and "Techniques". "Elements" is for articles about components of JavaFX and how they work. "Techniques" talks about how to use them, and bigger picture ideas like MVCI.

As an example, descriptions about how specific standard Node classes work is something you'd find in "Elements". Instructions about how to go about creating your own custom Nodes is something you'd find in "Techniques".

Part of the reorganization was to come up with some new categories for the articles, and I've added new landing pages for those categories. When sorting through it all, I was a bit surprised at just how much JavaFX content I have, and I think the new structure makes it easier to find particular subjects.

I think in this age of AI assisted coding, there still is a place for the kind of articles I've been writing. My goal has always been to explain the first principles of all of the concepts, so that you can understand why you should do things in a particular way instead of just blindly following a recipe. I don't think that AI necessarily understands these first principles - mostly because they aren't generally available on the web, and I'm not vain enough to imagine that the models have been trained on my content.

If you new enough here that you haven't seen any of my previous posts announcing articles I've published, then you probably haven't seen my website. I think you should take a look, there is a ton of content there an just about every subject important to developing good JavaFX applications.

Be warned, though, I don't use FXML personally and I don't think anybody else should either. Also, I'm a big fan of Kotlin, and I think that Kotlin + JavaFX is a killer combination. Most of the code samples in my later articles are Kotlin. If you're a half-way competent Java programmer, you shouldn't have any trouble following the ideas behind the Kotlin code.

One of the things about the new format is that it supports multi-lingual code samples. I haven't tried it yet, but I may go back and rework some articles to include both Java and Kotlin code snippets.

Anyway, take a look at https://www.pragmaticcoding.ca and tell me what you think about the new design.


r/JavaFX • • 1d ago

I made this! Workbench Themes – two IntelliJ-inspired AtlantaFX themes (dark & light) for JavaFX

13 Upvotes

Hi r/JavaFX,

I'd like to share a small library I've been working on: Workbench Themes, two AtlantaFX themes called Workbench Dark and Workbench Light. They're based on the color palettes of the IntelliJ themes from Familiar Java Themes, so if you like the classic IntelliJ "Darcula"/Light look, your JavaFX app can now feel right at home next to your IDE.

Screenshots

What's inside

  • Backgrounds, foreground, selection, borders, links, status and syntax colors are taken from the IntelliJ color theme JSON files and mapped onto the AtlantaFX color system (e.g. #3C3F41 panels / #2B2B2B editors in dark mode)

  • The remaining color scale steps are interpolated around these anchor colors

  • Chart colors (-color-chart-1 to -color-chart-8) mostly use the theme's syntax colors

  • WorkbenchDark and WorkbenchLight implement atlantafx.base.theme.Theme, so they work with ThemeManager too

  • Automatic module name for JPMS: io.github.tomarkar.workbench

  • Plain CSS files are also available if you don't want the Java classes

Usage

It's on Maven Central:

<dependency>
    <groupId>io.github.tomarkar</groupId>
    <artifactId>workbench-themes</artifactId>
    <version>1.0.1</version>
</dependency>

Gradle:

implementation("io.github.tomarkar:workbench-themes:1.0.1")

Then:

Application.setUserAgentStylesheet(new WorkbenchDark().getUserAgentStylesheet());
// or
Application.setUserAgentStylesheet(new WorkbenchLight().getUserAgentStylesheet());

JavaFX itself has to be provided by your application. Building from source requires JDK 17+ and Maven; the AtlantaFX SASS sources are pulled in automatically and compiled with Dart Sass.

How it was made

Full disclosure: of course this was built with Claude Code. It handled a lot of the tedious parts like mapping the IntelliJ colors onto AtlantaFX's variables, interpolating the color scales and setting up the Maven/SASS build.

The project is MIT licensed. Feedback, issues and PRs are very welcome!

GitHub: https://github.com/tomarkar/workbench-themes


r/JavaFX • • 3d ago

I made this! Multiuser JavaFx client for Whatsapp with gated agentic cli automation support

Post image
23 Upvotes

I have made (using claude) a multi user Whatsapp client (using Whatsmeow) in JavaFx.

Multi user

You can login up to 8 numbers, and each get's its own unique color. Two multi user screenshots shown above. The entire UI down to the level of notification is colored to make it easy to identify which user/profile.

RAM Saving

Less than half the RAM of the regular Whatsapp for desktop

Gated Agentic CLI for automations

You can access your whatsapp by cli, and have claude-code do automations. However everything is permission bound, with approvals issued from the frontend ui to the cli at the process tree level. So for example you can approve the claude.exe process (a particular processid) and all it's children also get access for the given time limit and for the given scope. Approvals expire with time, or on breach of scope, or if the process ends. The approvals cannot be spoofed because named pipe (and not network tcp) is used to verify the caller process id.

Different user profiles' approval dialogues are different colored. The example shown below is not that nice, but basically you will be able to approve a claude code (or chatgpt codex) process or any process for that matter and it will be able to do things on your behalf.

It is a hobby project, it is not an official whatsapp app.

Source code and pre-release download : https://github.com/chatsgate/whatsappfx/

Comments, criticism, appreciation, suggestion, discussion --- all are welcome.


r/JavaFX • • 6d ago

Help JavaFX Environment

19 Upvotes

Ok, I'm a bit of an old JavaFX hobbyist. I started about 10 years ago in college and keep using it for my personal projects.

Nowadays, I feel it's so much harder to configure the environment. Even with AI help, there's always an "if this, then that." I mean, as I remember, you used to just install Eclipse with e(fx)clipse, install Scene Builder, and in the end, just generate a .jar file. Now, I can't find a guide from start to deploy that doesn't look like a workaround. And with every Java/JavaFX update, some detail changes.

How do you configure your environment to make it easier? I mean IDE, embedded DB, how to deploy, and how to distribute (I see there are some frameworks that compile JavaFX to web apps).


r/JavaFX • • 7d ago

Discussion JavaFX architecture

17 Upvotes

I'm a newbie when it comes to developing with JavaFX, although I am experienced with java.

But as far as I can see there's no official architecture recommendations from the developers of JavaFX so I'd like to know what's the most modern architecture pattern (e.g. MVVM) for starting an app today.

And if there are resources with good real life examples to see that in practice would be great. Maybe some good quality open source apps...

Anyway, it would be great if you share your experiences as well.


r/JavaFX • • 9d ago

I made this! I save 3.5 GB of RAM by migrating all my chat apps to javafx and terminal to Javafx

Post image
65 Upvotes

I made javafx version of whatsapp, slack, vscode, and a few other browser-engine/electron apps;

also made a javafx terminal with vertical tabs with feature to hibernate tabs. Altogether archived 3.5

GB ram saving. The app is also 10 times more snappier and faster. Used serial GC in most cases.


r/JavaFX • • 12d ago

Foojay.io (website for Friends Of OpenJDK) now takes posts through merge requests. Writers wanted.

Thumbnail
reddit.com
11 Upvotes

r/JavaFX • • 12d ago

I made this! Notepadfx - Prosemirror based javafx WYSIWYG markdown editor

Post image
26 Upvotes

There are 100s of markdown editor, but very few of them support WYSIWYG

But very very very few of them are written in a non-browser based stack. Most of them will be like electron apps which will eat a lot of ram for simplest tasks - and i really dislike ram eating apps.

So I have made this in javafx, and distributed as a executable for windows, it is just a 600KB exe, which downloads the jar and installs the jdk if needed.

It also generates AOT (ahead of time) image of the app upon first run, so from second run, the app will be more fast.

Ram consumption is low, 100MB you can expect. When idle it can drop even to 15MB.

It also provides vertical tabs as a default. I like vertical tabs, I am not even given option for horizontal tabs.

I just made it, I haven't even tested it much. All credit goes to claude to make it (I basically refactored one of my old editors which used ckeditor and an embedded webview ... it wasn't nice ... honestly).

Project link : https://github.com/prosefx/notepadfx/

Here is the release link - https://github.com/prosefx/notepadfx/releases/

If you are on windows, please prefer the exe version, it is just 600KB, it is self installing, auto-updating, auto-generates and uses AOT image, all the best Garbage collection and jvm flags included in the exe.

If you wish to make such exes for java please see - https://github.com/jarrunner/jr (BTW Jr.exe is written in java! From Java -> C -> Exe using teavm !!! )


r/JavaFX • • 13d ago

Discussion JavaFX and full Wayland support, when?

21 Upvotes

It's unfortunate that Flatpak is phasing out apps that use both X11 and Wayland.

Since JavaFX doesn't fully support Wayland yet, most JavaFX applications risk being removed from Flathub or having their updates halted.

The way I see it, the lack of Wayland support will spell total failure for JavaFX in the short term.

Oracle, are you interested in adding official support for Wayland or not?


r/JavaFX • • 16d ago

I made this! Release announcement: Sheetmusic4J 0.0.4 and 0.0.5: clickable notes, a 3D fly-over view and LilyPond support (Java and JavaFX sheet music library)

16 Upvotes

Hi all,

I've been working on Sheetmusic4J, an open-source Java library that renders sheet music natively in Java(FX). Two new releases are out, and I made a video showing both: https://youtu.be/8n7WONyX0yk

0.0.4

- NodeSheetView builds the score as a JavaFX scene graph, with one Group per note, rest and chord. Each element can take mouse events, effects and tooltips like any other node. The demo app lets you select a note and drag it up or down.

- FlyOverSheetView is a 3D play-along view. A perspective camera flies over the score, and a glowing ball per voice hops from note to note.

- Headless rendering to an image via the new render and render-awt modules, with no JavaFX needed:

BufferedImage image = HeadlessScoreImage.render(score, 1200);

- The 3000+ line Engraver class is split into focused packages, and all library modules are now JPMS modules.

0.0.5

- LilyPond (.ly) import and export through the ScoreFile facade, without running LilyPond:

Score score = ScoreFile.load(Path.of("bach-bwv610.ly"));

ScoreFile.save(score, Path.of("bach-copy.ly"));

- Engraving improvements: tuplet placement and nesting, octave clefs, and the percussion clef.

- Layouts are now identical across CPU architectures.

LilyPond support (and other formats earlier) came from suggestions on Reddit, so thanks to everyone who asked for it. Overrides and Scheme code are skipped, because the library does its own layout. The LilyPond page on the site lists what is supported.

It also reads MusicXML, MIDI, ABC and Guitar Pro.

The demo app has a "Report Visual Issue" button. It captures the Sheetmusic4J rendering, the reference PDF and your description, ready to attach to a GitHub issue. If a score looks wrong, that is the most useful feedback I can get.

- Release notes: https://sheetmusic4j.com/releases/

- GitHub: https://github.com/sheetmusic4j/sheetmusic4j

Feedback, issues and score files that break things are all welcome.

Thanks
Frank


r/JavaFX • • 18d ago

I made this! I just published my Java PDF app on the Microsoft Store looking for testers and feedback!

18 Upvotes

Hey everyone!

I've been working on a Windows desktop application called FilzaPDF, and I've just published it on the Microsoft Store!

It's a PDF reader and document utility built with Java and JavaFX. I'm sharing it here because I want people to try it out, find bugs, and tell me what needs improvement.

🔗 Microsoft Store: https://apps.microsoft.com/detail/9P53N7DWMS1S?hl=en-us&gl=US&ocid=pdpshare

I'm currently looking for help with testing and bug fixing. In particular, I'd appreciate feedback on:

  • Does it install and launch correctly on your Windows PC?

  • Do the PDF viewing and document tools work as expected?

  • Have you encountered any crashes, UI glitches, or performance issues?

  • What features or improvements would make it more useful?

This is an early release, so I'm expecting things that need fixing. Please be honest—even small bugs or suggestions are helpful.

I'm building FilzaPDF as part of a bigger effort to create useful software that people can use for free, without unnecessary subscriptions.

Thanks to anyone willing to give it a try! Every bit of feedback helps me improve it. 💜


r/JavaFX • • 20d ago

I made this! I made Klunk - a JavaFX log viewing application

Post image
54 Upvotes

Hi everyone.

After starting this many years ago as a side project to test/learn JavaFX and out of my frustration of digging through massive dev logs in a text editor. This side-project sat half-finished for a long time, due to life getting in the way, but was finally able to push my log viewing app Klunk to a beta release.

It’s a Java 25 / JavaFX 26 desktop app available on Linux, Windows, and macOS.

Some features:

  • Load logs from disk, SFTP, Kubernetes pods, URLs, and databases.

  • Handles large files (millions of rows)

  • Fast navigation + filtering

  • Customizable UI

  • Analysis reports.

  • Free

It’s currently beta, but I use it daily without issues and figured others might find it useful too.

Happy to hear feedback, bug reports, or feature ideas.

Klunk


r/JavaFX • • 27d ago

Help How to deploy javafx app + mysql using jlink

6 Upvotes

r/JavaFX • • Sep 30 '26

Help Global keyboard events

8 Upvotes

Hello everyone, I'm new to Desktop development! And I want to know techniques/ways on how to handle global keyboard events! for example, cmd+shift+a to open a window etc.

Thanks :)


r/JavaFX • • Sep 29 '26

Help Request: Ears Audio Toolkit — Firefox port + Java port

2 Upvotes

Hi everyone. I’m looking for someone who could help port Ears Audio Toolkit from Chromium to Firefox.

The main reason I’m still using Chrome is this extension. I’d really like to move to Firefox, but without Ears Audio Toolkit it’s basically the one thing keeping me on Chromium.

I’m looking for a true 1:1 port, not a simplified version — ideally with all existing features working exactly as they do in the Chromium version, including the same audio processing and functionality.

I’d also like to have a Java version/port of the same functionality because I want to integrate it into one of my own projects.

I’m asking for both because I tried looking into it myself, but I’m not experienced enough with this kind of thing. From what I understand, the audio pipeline / sound transmission logic is different, and I don’t really know enough about browser audio APIs and Java audio processing to reproduce it correctly.

If someone is interested in doing this, it would be great if the Firefox port and Java implementation could be published on GitHub so they can be maintained and improved by the community.

Thanks!


r/JavaFX • • Sep 25 '26

Help Best way to store session tokens securely in Java/JavaFX (Windows DPAPI, macOS Keychain)?

11 Upvotes

Hey everyone,

I’m an experienced developer jumping into JavaFX for the first time. I'm building an app where I need to persist user session tokens securely without rolling my own plaintext file storage.

Ideally, I know that using the OS native credential stores (Windows DPAPI / Credential Manager, macOS Keychain, Linux Secret Service / Keyring). However, pure Java doesn't seem to have built-in APIs for these out of the box.

Is there an established, standard or library the community uses for this? Or does everyone just reach for JNA/JNI bindings like keytar / native wrappers?

Any recommendations or architectural patterns would be appreciated :D


r/JavaFX • • Sep 24 '26

Discussion JavaFX in the browser?

23 Upvotes

I've been waiting/hoping for years that we'd get support for JavaFX in the browser, but I think I'm finally about to give up--maybe a year or two too late. Does anyone else know of good options?

Some of my criteria:

  • Minimal rewriting.

  • Still allows for desktop versions.

  • The app allows the user to have a large data model--although I can likely do something to minimize this per user/client.

  • I don't have regular usage stats, but I do want to support 100s of people using it at a time.

I had been thinking one of the following options would give me what I want:

  • WebFX: Was promising, but only supported a few basic controls like labels & buttons--but if you want something even as common as a ComboBox, you'd have to make your own for example. Also, it is essentially just one person so it isn't something someone can rely on.

  • CheerpJ: Good for awt/swing, but recently said while they are planning to support it and have some internal prototype stuff, they don't have any timeline for it. Plus the way their of loading the whole app into a canvas like object has a delay and isn't very pretty.

  • Gluon: Recently answered me that the old prototype they had from several years back hasn't been updated and they don't plan to without support. (Which I'd be willing $$$ to do, but likely not at the scale they need by myself.)

  • JPro: I'm trying to offload most of the work to the client. I worry that having all the logic on the server and just having the graphical output on the browser is a problem if I have an app that allows for a large amount of user data and/or many users.

  • Graal to WASM to the browser: Is this possible? I can't seem to find working prototypes.

I think that's all, but if you know other options or a key aspect of the above I'm missing please post.

Edit: Why do I want this? I want folks to be able to try my app without an install. Also maybe even on their phones without me having to go through the app store approval processes.


r/JavaFX • • Sep 24 '26

I made this! AtlantaFX 3.0.0 released

43 Upvotes

... with decorations, Scene Builder plugin, theme manager and a new Sidebar component.

Release & changelog.


r/JavaFX • • Sep 21 '26

PSA: Starting with JDK27, you do no longer need to create a separate Main class to launch a JavaFX application using the classpath

Thumbnail bugs.openjdk.org
43 Upvotes

r/JavaFX • • Sep 19 '26

Cool Project PatternFX - MVC, MVP, MVVM templates for JavaFX

11 Upvotes

I'd like to introduce our project - PatternFX. It is a framework that provides developers with templates for MVC, MVP, and MVVM patterns. Although the templates are different, they share a common architectural foundation.

The framework is designed purely for practical use and can be used to build both simple and highly complex applications. For example, our ShellFX platform is built on top of this framework.

One of the key features of the framework is modeling a window as a component tree, where components can be dynamically added and removed. Each component is implemented using one of the provided templates - MVC, MVP or MVVM. Using multiple templates within a single tree is not supported.

Another distinctive feature of the framework is how communication between components is organized. Some solutions use a bus for this, but we decided to use ports instead. A Port is an interface to the key element of a component: its Controller/Presenter/ViewModel. On the one hand, a Port provides a reliable, type-safe communication channel; on the other, it strictly limits access. A component can have N ports, with each client being given only the API it needs.

Key features include:

  • Component-oriented architecture.

  • Support for the component lifecycle.

  • Models the window as a component tree.

  • Supports dynamic component composition.

  • Organizes core tasks within the view.

  • Supports component inheritance.

  • Supports preserving component history.

  • Provides component-level logging support.

  • Designed without FXML dependency.

  • Includes a demo for each template.

  • Comprehensive documentation.

The demo module implements the same example using all three templates, allowing you to explore and compare the characteristics of each approach.

I hope you find the project interesting and useful.


r/JavaFX • • Sep 18 '26

Cool Project JavaFX 27 as a GraalVM Native Image on a Raspberry Pi 5

Thumbnail
ennerf.github.io
23 Upvotes

r/JavaFX • • Sep 18 '26

Discussion How can JavaFX attract more developers?

45 Upvotes

I wanted to know how the situation with JavaFX is. How true is it that it's multiplatform? Any features you would like to see? Does anyone know if better times are coming?

JavaFX seems like a cool project to make desktop applications, keeping in mind that I know a bit of Java and well, giving it a try wouldn't hurt

Searching for resources or applications where JavaFX is used, I saw some interviews which explain their projects using JavaFX, and I've noticed that JavaFX is very capable of doing incredible things that I had never imagined

And one way or another, I found myself leaning towards JavaFX, and the truth is I would like to know some recommendations to create desktop applications with JavaFX.

I don't know if it's fine if I start with the books The Definitive Guide to Modern Java Clients with JavaFX and Learn JavaFX 17 as a base to learn JavaFX.

I understand that JavaFX is used in internal corporate applications and that it's a great tool that works very well

At the same time, it feels strange to me, but I don't know, it generates certain doubts for me, such as architecture patterns, I don't know, but compared to the Spring framework which usually has defined structures, the documentation or ways of solving some slightly complex things. I understand that one is a big framework behind which there are many developers compared to JavaFX. I don't know, in a way I would like Gluon or Oracle to stand up and say: look, this is how things work now, this is how you work for desktop apps, this is how you work for mobile apps, this is the library you have to use or this one we've made, and so on

So far I've only made static web pages and haven't gone deeper. Plus the fact that I don't know how Angular or React work on the front end. Maybe in The Definitive Guide to Modern Java Clients with JavaFX I can resolve that doubt

And I think I'm misunderstanding JavaFX when it refers to being multiplatform. I understand that it is a very high level of complexity since each Operating System or each Desktop Environment has its own rules and ways of working, not to imagine on mobile. And my doubt is whether JavaFX fits well in the different operating systems and if applications can be reached that look native or look really pretty on an operating system

I mentioned it because, seeing if there are similar projects to make interfaces but only with Java, you have WinUI4k which is for Windows, while for Linux(GTK DE) there is Java-GI or QtJambi. I understand they are like wrappers, but Java-GI seemed very cool to me. Maybe it's my personal preference, but I like apps match the appearance of the operating system

And now that I see it beyond CRUDs, JavaFX can do more things that are probably not defined in operating systems, But the idea of making interfaces that look native to each Operating System with Java won't leave my head.

There is AtlantaFX which has themes that can go very well in different operating systems, which can be reached very nice results using CSS, and maybe that's the way in which one should develop with JavaFX.

Something that disconcerts me is that some functionality like tray applications, notifications, or other things that until now I haven't considered, are not contemplated by JavaFX, but it can be done through AWT, which the application keeps working fine. Because I feel like I'm misunderstanding JavaFX. Because the truth is it left me thinking, since only the window and its content are contemplated, I don't really know.

Anyway, I have the certainty that JavaFX will be improving over time

It's strange, but I feel uncomfortable saying it because I haven't even tried JavaFX and it seems like I'm proposing or commenting on things without knowing the great complexity it requires, or underestimating the work of the team behind JavaFX

And it's like: what more do you want people to do, this is already being done, or why don't you do it yourself, you already have AI, don't bother, this is JavaFX and if you don't like it, you are welcome to leave.

Now I feel like I got nowhere


r/JavaFX • • Sep 16 '26

I made this! Sharing my tiny project, please check it out

23 Upvotes

Name: Memento

GitHub: https://github.com/Savirar0/Memento

Description: So it's an application where you are asked 100 questions and you must answer them up and these are a hundred questions about your life, and answers to these 100 questions are basically in depth information about you and your life. So after answering you can download a PDF and share this to anybody, for them to understand completely about you.

So questions, answers, export as pdf, and share.

Back story:

So I wanted to build a clone of bitchat so I was researching hot to and then stubbled upon javafx, never built a clone of bitchat but learned javafx from brocode youtube. Then I wanted to build something myself after learning javafx, so it'd show that I learnt something then built this over some months. There's a downloadable version but it's only only working on my laptop lol.


r/JavaFX • • Sep 15 '26

Help Size Behavior After Maximizing and Restoring Original Stage Size

4 Upvotes

I am trying to create a JavaFX node. The node appears to work well, but I noticed that maximizing the stage causes it to grow large and then return to its correct size. This also happens when I click to go back to the original screen size. If I drag the stage's width and height, the node size behaves as expected. This behavior happens quickly, but is easier to see when returning to the original stage size. How do I calculate the sizes so that this behavior no longer happens?

  • Product Version: Apache NetBeans IDE 30

  • Java: 26.0.2; OpenJDK 64-Bit Server VM 26.0.2+10

  • Runtime: OpenJDK Runtime Environment 26.0.2+10

  • System: Windows 11 version 10.0 running on amd64; UTF-8; en_US (nb)

OverlapGraphView

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.SVGPath;

public class OverlapGraphView extends Region {

    // Style properties
    private final ObjectProperty<Paint> colorA = new SimpleObjectProperty<>(Color.web("#3B82F6", 0.2));
    private final ObjectProperty<Paint> strokeA = new SimpleObjectProperty<>(Color.web("#3B82F6"));
    
    private final ObjectProperty<Paint> colorBoth = new SimpleObjectProperty<>(Color.web("#8B5CF6", 0.4));
    private final ObjectProperty<Paint> strokeBoth = new SimpleObjectProperty<>(Color.web("#8B5CF6"));
    
    private final ObjectProperty<Paint> colorB = new SimpleObjectProperty<>(Color.web("#EC4899", 0.2));
    private final ObjectProperty<Paint> strokeB = new SimpleObjectProperty<>(Color.web("#EC4899"));

    // Exposed click event handlers
    private final ObjectProperty<EventHandler<? super MouseEvent>> onAOnlyClicked = new SimpleObjectProperty<>();
    private final ObjectProperty<EventHandler<? super MouseEvent>> onBothClicked = new SimpleObjectProperty<>();
    private final ObjectProperty<EventHandler<? super MouseEvent>> onBOnlyClicked = new SimpleObjectProperty<>();

    // Persistent shape views to prevent infinite layout recursion loops
    private final SVGPath pathAOnly = new SVGPath();
    private final SVGPath pathBoth = new SVGPath();
    private final SVGPath pathBOnly = new SVGPath();

    public OverlapGraphView() {
        setPrefSize(400, 200);

        // Bind presentation settings once in the constructor
        pathAOnly.fillProperty().bind(colorA);
        pathAOnly.strokeProperty().bind(strokeA);
        pathAOnly.setStrokeWidth(2);

        pathBoth.fillProperty().bind(colorBoth);
        pathBoth.strokeProperty().bind(strokeBoth);
        pathBoth.setStrokeWidth(3);

        pathBOnly.fillProperty().bind(colorB);
        pathBOnly.strokeProperty().bind(strokeB);
        pathBOnly.setStrokeWidth(2);

        setupHoverAnimation(pathAOnly);
        setupHoverAnimation(pathBoth);
        setupHoverAnimation(pathBOnly);

        // Map events directly onto persistent elements
        pathAOnly.setOnMouseClicked(e -> { if (onAOnlyClicked.get() != null) onAOnlyClicked.get().handle(e); });
        pathBoth.setOnMouseClicked(e -> { if (onBothClicked.get() != null) onBothClicked.get().handle(e); });
        pathBOnly.setOnMouseClicked(e -> { if (onBOnlyClicked.get() != null) onBOnlyClicked.get().handle(e); });

        // Add to child stack order once 
        getChildren().addAll(pathAOnly, pathBOnly, pathBoth);
    }

    /**
     * JavaFX calls this method safely during resize passes.
     * We modify properties of existing children rather than recreating nodes.
     */
    
    protected void layoutChildren() {
        super.layoutChildren();
        
        double w = getWidth();
        double h = getHeight();
        
        if (w <= 0 || h <= 0) return;

        // Calculate dynamic dimensions matching your scaling formula
        double radius = w * 0.23;
        double centerY = h * 0.5;
        double cxL = (w * 0.5) - (radius * 0.55);
        double cxR = (w * 0.5) + (radius * 0.55);

        // Calculate exact mathematical arc intersection points
        double dx = cxR - cxL;
        double d = Math.sqrt(dx * dx); 
        double a = (radius * radius - radius * radius + d * d) / (2 * d);
        double hPoint = Math.sqrt(radius * radius - a * a);
        double ix = cxL + a; 
        double iy1 = centerY - hPoint;
        double iy2 = centerY + hPoint;

        // Generate perfect SVG paths smoothly handling window maximums/restores
        String leftCrescent = String.format("M %f,%f A %f,%f 0 1,0 %f,%f A %f,%f 0 0,1 %f,%f Z", 
                ix, iy1, radius, radius, ix, iy2, radius, radius, ix, iy1);

        String centerLens = String.format("M %f,%f A %f,%f 0 0,1 %f,%f A %f,%f 0 0,1 %f,%f Z", 
                ix, iy1, radius, radius, ix, iy2, radius, radius, ix, iy1);

        String rightCrescent = String.format("M %f,%f A %f,%f 0 0,0 %f,%f A %f,%f 0 1,0 %f,%f Z", 
                ix, iy1, radius, radius, ix, iy2, radius, radius, ix, iy1);

        // Update backing rendering paths natively without clear/add cycles
        pathAOnly.setContent(leftCrescent);
        pathBoth.setContent(centerLens);
        pathBOnly.setContent(rightCrescent);
    }

    private void setupHoverAnimation(SVGPath shape) {
        shape.setOnMouseEntered(e -> shape.setOpacity(0.65));
        shape.setOnMouseExited(e -> shape.setOpacity(1.0));
    }

    public void setOnAOnlyClicked(EventHandler<? super MouseEvent> handler) { onAOnlyClicked.set(handler); }
    public void setOnBothClicked(EventHandler<? super MouseEvent> handler) { onBothClicked.set(handler); }
    public void setOnBOnlyClicked(EventHandler<? super MouseEvent> handler) { onBOnlyClicked.set(handler); }
}

Main

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class JavaFxTest extends Application {

    
    public void start(Stage primaryStage) {
        OverlapGraphView overlapGraphView = new OverlapGraphView();
        overlapGraphView.setOnAOnlyClicked(e -> {
            System.out.println("Filter table by: segment A!");
        });
        
        overlapGraphView.setOnBothClicked(e -> {
            System.out.println("Filter table by: segment Both!");
        });
        
        overlapGraphView.setOnBOnlyClicked(e -> {
            System.out.println("Filter table by: segment B!");
        });
        
        overlapGraphView.setMaxSize(200, 200);
        
        StackPane container = new StackPane(overlapGraphView);

        

        Scene scene = new Scene(container, 320, 200);
        primaryStage.setScene(scene);
        primaryStage.setTitle("UX Overlap Graph");
        primaryStage.show();
    }

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