RFR: 8324941: POC for Headless platform for JavaFX [v4]

Andy Goryachev angorya at openjdk.org
Thu Jun 26 21:04:46 UTC 2025


On Thu, 26 Jun 2025 20:35:32 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessApplication.java line 138:
>> 
>>> 136:     @Override
>>> 137:     protected Screen[] staticScreen_getScreens() {
>>> 138:         final int screenWidth = 1000;
>> 
>> Should this be something that can be configured by the developer? E.g. a simple system property with a default value of 1000?
>
> This is a good question, and I believe it is part of a broader discussion. There are a number of places (e.g. here) where I use hardcoded, default values which should be fine for most usecases I'm aware of. However, I believe there is definitely value in having more configurable values (e.g. in screen dimensions, but also number of screens, default window sizes, multiclick values etc).
> The challenge with this is that we need some way to have developers manipulate these values, for example using system properties (as you state as well). This is then adding a feature that doesn't exist yet, so it would require a deeper discussion on how to make the Headless platform configurable. I'm absolutely +1 on that, but I believe it would be easier if we do that as a follow-up?

I was going to suggest a system property like

-Dheadless.screens="1920x1024"
-Dheadless.screens="1920x1024x16"

to be able to configure the screen resolution and the bit depth (and maybe a scale as well).

I don't know whether supporting multiple screens makes sense here, but perhaps for testing?

And, if the code cannot parse the property it would default to something reasonable like 1280x768 or slightly larger?

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2170006491


More information about the openjfx-dev mailing list