On Mon, 17 Aug 2026 12:41:25 GMT, eduardsdv <[email protected]> wrote:
>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java
>> line 560:
>>
>>> 558: text.setText("");
>>> 559: } else {
>>> 560: textWidth =
>>> snapSizeX(Math.min(text.getLayoutBounds().getWidth(), wrapWidth));
>>
>> `ignoreText` would be true in two cases, either
>> - when the text is empty / null or
>> - `ContentDisplay.GRAPHIC_ONLY` is true. refer [
>> LabeledSkinBase.isIgnoreText()](https://github.com/openjdk/jfx/blob/3b54913c53f5ac079278a934081d87ce7d55173f/modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java#L1241)
>>
>> With this change, `updateDisplayedText()` gets invoked unconditionally even
>> for the scenario when the text is non-empty, but needs to be ignored because
>> `ContentDisplay.GRAPHIC_ONLY` is true.
>>
>> Please check if this can cause any issue.
>
> You are right.
> This is my approach to fix the issue by calling the ``updateDisplayedText()``
> regardless of the value of ``ignoreText``. Otherwise, the
> ``containsMnemonic`` value may be stale.
>
> I added additional tests to check combinations
> ``ContentDisplay.GRAPHIC_ONLY`` and ``ContentDisplay.TEXT_ONLY`` with empty
> and null text.
When `ContentDisplay.GRAPHIC_ONLY` is true, and text is **non-empty**: Calling
`updateDisplayedText()` may result in invoking `addMnemonic();` and
`getChildren().add(mnemonic_underscore);`. [ refer the method
`updateDisplayedText()` , unable to share links due to Github outage ]
This can result in addition of an un-required node to scenegraph.
The proposed change fixes the exception, but it seems to be introducing a
regression.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2253#discussion_r3797081294