On Mon, 17 Aug 2026 16:44:31 GMT, Kevin Rushforth <[email protected]> wrote:
>> 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.
>
> Perhaps another option would be to reset the `containsMnemonic` flag in the
> `if (ignoreText)` block rather than calling `updateDisplayedText`?
I also tested a new condition in the ``layoutLabelInArea()`` method in the
following if-clause (``!ignoreText``).
The test are running green and also no additional children are added in case of
``ContentDisplay.GRAPHIC_ONLY``.
Point2D mnemonicPos = null;
double mnemonicWidth = 0.0;
double mnemonicHeight = 0.0;
if (!ignoreText && containsMnemonic) {
final Font font = text.getFont();
String preSt = mnemonicInfo.getText();
boolean isRTL = (labeledNode.getEffectiveNodeOrientation() ==
NodeOrientation.RIGHT_TO_LEFT);
mnemonicPos = Utils.computeMnemonicPosition(font, preSt,
mnemonicInfo.getMnemonicIndex(), this.wrapWidth, labeled.getLineSpacing(),
isRTL);
mnemonicWidth = Utils.computeTextWidth(font,
preSt.substring(mnemonicInfo.getMnemonicIndex(),
mnemonicInfo.getMnemonicIndex() + 1), 0);
mnemonicHeight = Utils.computeTextHeight(font, "_", 0,
text.getBoundsType());
}
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2253#discussion_r3797334564