Is there a way to easily change the window border color?

John Hendrikx john.hendrikx at gmail.com
Mon May 1 21:28:40 UTC 2023


No easy way as of yet, the border isn't created by JavaFX but by 
Windows, and I think JavaFX is not responding to the global LIGHT/DARK 
settings of the platform.  You could try use the StageStyle UNDECORATED 
or UNIFIED, but that would still involve rendering your own border.

Other options may include getting the HWND handle and using Windows API 
directly to change the style.  Getting the HWND (using Windows API) is 
not too hard, but I'm not sure what you may need to do to change the 
Window border to use the dark theme.

--John

On 01/05/2023 22:45, Davide Perini wrote:
> Hi all,
> is there an easy way to change the window border color in JavaFX?
>
> I would not like to create a custom border since I like to use the 
> "native window border" look n feel,
> but how can I match the color with the one used in the OS?
>
> I'm using Windows 11 here,
>
>
>
> as you can see from this image, Windows explorer uses a dark grey 
> border, while my JavaFX app uses the light grey color.
>
> How can I change that color without creating a custom "window border"?
>
> Thanks
> Davide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230501/b77f6dd0/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: XkvmWtJR6f3y8rZb.jpeg
Type: image/jpeg
Size: 125179 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230501/b77f6dd0/XkvmWtJR6f3y8rZb-0001.jpeg>


More information about the openjfx-dev mailing list