Feature Request: Support for Transparent Title Bars in JavaFX Stages

Christopher Schnick crschnick at xpipe.io
Thu Apr 3 15:08:51 UTC 2025


I just want to add that the native window handles are available prior to 
the windows being shown if you listen to the observable list 
Window.getWindows().

On 02/04/2025 16:01, Bahaa Zaid wrote:
> Hello,
>
> Modern macOS apps tend to expand the client area of the window to take 
> the entire window area including the titlebar. This is usually done by:
>
>  1. Setting NSWindow.titlebarAppearsTransparent to true.
>  2. Setting NSWindow.styleMask NSWindowStyleMaskFullSizeContentView flag.
>
>
> This can be useful because it gives the app modern look, make use of 
> all available window real-estate, and allows JavaFX developers to 
> create completely custom windows like UNDECORATED styles without 
> loosing the platform resize-window feature and the three window buttons.
>
> Swing supports this already using code like this:
> final var frame = new JFrame();
> final var rootPane = frame.getRootPane();
> rootPane.putClientProperty("apple.awt.fullWindowContent", true);
> rootPane.putClientProperty("apple.awt.transparentTitleBar", true);
>
> This can be done easily today using reflection to access non-public 
> API to get the Stage native NSWindow handle and using FFM to change 
> styleMask and set the titlebarAppearsTransparent property. I have 
> created an example here 
> (https://github.com/bahaa/jfx-transparent-window-titlebar). But this 
> approach has the following drawbacks:
>
>   * It uses non-public API.
>   * JavaFX stage native window handle is available only after the
>     stage is shown, this cause some flicker because the window style
>     is changed after it’s shown to the user.
>
>
> I think JavaFX should support this out of the box. One possible 
> solution is to introduce a new StageStyle that behaves like UNIFIED 
> style (it falls back to DECORATED) if it’s not supported by the 
> platform. I think something similar can be done on Windows 
> (https://learn.microsoft.com/en-us/windows/win32/dwm/customframe) but 
> I’m not sure about GTK.
>
> Thanks,
> Bahaa.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250403/7bfae024/attachment.htm>


More information about the openjfx-dev mailing list