JEP: JavaFX controls in the title bar

Andy Goryachev andy.goryachev at oracle.com
Fri Oct 25 17:22:48 UTC 2024


- Right-click system menu: you are right, we probably should not add an API to control the system menu.  However, it might make sense to have the HeaderBar show the system menu on Windows by default, unless the onContextMenuRequestedProperty is set.  What do you think?  Shouldn't the HeaderBar mimic the native behavior?

- HeaderBar height: so you explicitly do not want USE_NATIVE_HEIGHT = -5.0; constant (or something like that)?

But generally speaking, I think the method to achieve the same height as the native title bar should be described both in the JEP and the docs.

Also, and I might be wrong here - would this code stop working after the binding gets collected, unless you keep the reference to the created double binding:

headerBar.minHeightProperty().bind(
    Bindings.createDoubleBinding(

Thanks,
-andy


From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Michael Strauß <michaelstrau2 at gmail.com>
Date: Friday, October 25, 2024 at 09:46
To:
Cc: openjfx-dev <openjfx-dev at openjdk.org>
Subject: Re: JEP: JavaFX controls in the title bar
> - Right-click system menu: is there any way to provide this functionality somehow?  May be as a method in the HeaderBar?

This is probably more a question of whether we want to have this, not
of whether it is possible. The right-click system menu is a
Windows-only thing, it's not available on macOS and Linux.
As the name implies, the system menu is very system-dependent. Do we
want to add a system-dependent menu to a cross-platform framework?
If applications want to have a HeaderBar context menu, they can easily
add their own JavaFX ContextMenu.
Let's suppose we add the default system menu only on Windows. Then if
an application adds its own ContextMenu to HeaderBar, we would
probably expect the JavaFX ContextMenu to replace the default system
menu?



> Could you please add these two columns to the table, even if they contain N/A.

Done.

> - left/rightSystemInsets: thank you, you probably want to clarify that in these properties' javadoc.

Done.



> - HeaderBar height: my question was what should the application developers do in order to make the height of the bar to be the same as the native one?  Maybe there should be a constant similar to Region.USE_COMPUTED_SIZE to accomplish that?

We could change the layout algorithm such that HeaderBar.minHeight is
ignored when it is less than the height of the system insets. However,
that would restrict the flexibility of application developers
(HeaderBar is resizable, after all).
Another option is that application developers could do something like this:

headerBar.minHeightProperty().bind(
    Bindings.createDoubleBinding(
        () -> Math.max(headerBar.getLeftSystemInset().getHeight(),
                       headerBar.getRightSystemInset().getHeight()),
        headerBar.leftSystemInsetProperty(),
        headerBar.rightSystemInsetProperty()));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20241025/fbdc4828/attachment-0001.htm>


More information about the openjfx-dev mailing list