What I often do when I want to test changes to FX internals is to not
build FX at all, but instead just copy the classes I need to change into
my project and leaving them in the internal package.

So for example, I want to change something in Window, I just copy the
class into my mini project:

- src/main/java/javafx/stage/Window.java
- src/main/java/app/MyApp.java
- pom.xml --> depends on JavaFX 25 maven artifacts or say 26-ea+18

No `module-info.java`

When you run this, you may get an error that you can't start your
application like this.  You can work around that with a mini launcher class:

     public void main(String... args) {
           Application.launch(MyApp.class, args);
     }

Now it starts without whining about module restrictions.

The Window class here can be modified in most ways, but you can't remove
methods that may be overridden.  You can remove "sealed" and "permits"
if you're copying a class that has those (like Node).

A screenshot of a project that I used to debug several issues over the
past few days:


--John


On 21/12/2025 22:27, Cormac Redmond wrote:
> Hi,
>
> Are there any tricks to quickly spinning up a visible application
> (from a test or otherwise), from within the JFX project, in order to
> see your changes?
>
> Obviously building the SDK and "using" it in an application is time
> consuming.
>
> I've seen this in build.gradle, where I assume StubToolKit
> automatically runs a sort of headless Application for tests without
> tests needing to manage it. Can it be replaced with anything?
>
>         test {
>             def cssDir =
>     file("${TEST_SDK_DIR}/shims/${moduleName}/javafx")
>             jvmArgs enableNativeGraphics
>             jvmArgs
>     "-Djavafx.toolkit=test.com.sun.javafx.pgstub.StubToolkit",
>                 "-DCSS_META_DATA_TEST_DIR=$cssDir"
>         }
>
> I know some people copy UI classes into their project (keeping the
> same package name as the real JFX control class, where it will take
> precedence), and develop/test it /there/. If that's the best solution
> to date, that's fine.
>
> In general, any other quick development tips (in the realm of quickly
> visually testing your changes) would be appreciated...
>
> Thanks in advance.
>
>
>
> Kind Regards,
> Cormac

Reply via email to