RFR: 8313424: JavaFX controls in the title bar [v21]

Andy Goryachev angorya at openjdk.org
Tue Nov 5 21:24:35 UTC 2024


On Tue, 5 Nov 2024 21:17:07 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> thanks for explanation.  but does it really warrant a base class, couldn't the app either set different components inside the existing HB, or maybe set a different HB?
>> 
>> is there anything that HeaderBar does that may not be needed in a custom title bar?
>> 
>> it just feels that HBBase is not needed.
>
> We need to think of this in terms of the user model. `HeaderBar` gives rise to three named areas (leading, center, trailing) and comes with a certain layout behavior for each of those areas.
> 
> Sure, it is possible to place another layout container in the `HeaderBar.center` area and set its prefWidth to infinity in order to effectively get rid of all of the custom layout behavior that `HeaderBar` brings to the table.
> 
> But that severely limits application and library developers from customizing the user model of the header bar. For example, using `HeaderBarBase`, a library developer can create alternative header bars with a different set of features and a different user model. Those alternative header bars might have different layout areas, different properties, in short a different API. It would be really awkward to shoehorn all of that into the (opinionated) API of `HeaderBar`.

I understand that, but could you give a **specific** example?

There is nothing in HB that prevents it from being used in all the scenarios I can think of.  It's like BorderPane - it can be used with a single center component, top and center, etc.  I just don't think we need a separate base class in this particular case, unless something in the HB **_prevents_** it.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r1830019029


More information about the openjfx-dev mailing list