<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>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().<br>
    </p>
    <div class="moz-cite-prefix">On 02/04/2025 16:01, Bahaa Zaid wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:96527358-3EA3-40DE-8992-658AF141C42E@gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      Hello,
      <div><br>
      </div>
      <div>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:</div>
      <div>
        <ol class="MailOutline">
          <li>Setting NSWindow.titlebarAppearsTransparent to true.</li>
          <li>Setting NSWindow.styleMask
            NSWindowStyleMaskFullSizeContentView flag.</li>
        </ol>
        <div><br>
        </div>
        <div>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.</div>
        <div><br>
        </div>
      </div>
      <div>Swing supports this already using code like this:</div>
      <div>
        <div>final var frame = new JFrame();</div>
        <div>final var rootPane = frame.getRootPane();</div>
        <div>rootPane.putClientProperty("apple.awt.fullWindowContent",
          true);</div>
        <div>rootPane.putClientProperty("apple.awt.transparentTitleBar",
          true);</div>
      </div>
      <div><br>
      </div>
      <div>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 (<a
href="https://github.com/bahaa/jfx-transparent-window-titlebar"
          moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/bahaa/jfx-transparent-window-titlebar</a>).
        But this approach has the following drawbacks:</div>
      <div>
        <ul class="MailOutline">
          <li>It uses non-public API.</li>
          <li>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.</li>
        </ul>
        <div><br>
        </div>
      </div>
      <div>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 (<a
href="https://learn.microsoft.com/en-us/windows/win32/dwm/customframe"
          moz-do-not-send="true" class="moz-txt-link-freetext">https://learn.microsoft.com/en-us/windows/win32/dwm/customframe</a>)
        but I’m not sure about GTK.</div>
      <div><br>
      </div>
      <div>Thanks,</div>
      <div>Bahaa.</div>
    </blockquote>
  </body>
</html>