On Thu, 24 Apr 2025 14:36:35 GMT, Michael Strauß <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/javafx/stage/StageStyle.java line 117:
>>
>>> 115: * <h4>Custom header buttons</h4>
>>> 116: * If more control over the header buttons is desired,
>>> applications can opt out of the default header buttons
>>> 117: * by setting {@link HeaderBar#setPrefButtonHeight(Stage, double)}
>>> to zero and providing custom header buttons
>>
>> Setting height to zero to disable something is unfortunately often misused
>> without actually disabling anything. Even though implemented correctly here,
>> I'd prefer a more semantic way of doing this, e.g. by adding a
>> "showHeaderButtons" property.
>
> I agree when it actually makes a semantic difference. For example, there's a
> difference between setting `Node.opacity` to zero, and setting `Node.visible`
> to `false`. In the first case, the node will still receive events, while in
> the second case it won't. But what's the semantic difference between
> non-existing header buttons, and header buttons with zero height?
>
> One argument against setting `prefButtonHeight` to zero could be that it
> special-cases one specific value (or two, because there's also the special
> value `USE_DEFAULT_SIZE`). In general, the property only describes a
> _preferred_ height, which the toolkit is free to honor (in any way it sees
> fit) or to ignore entirely. However, the two special values 0 and
> `USE_DEFAULT_SIZE` are specified to be honored by all toolkits in all cases.
Typically it's issues related to keyboard navigation that forget to handle the
zero-size case. But I agree it's ok to leave it as it is because it's
documented in a way that can be trusted.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1605#discussion_r2058660143