RFR: 8296653: ComboBox promptText is not displayed when the value is reset [v2]
Marius Hanl
mhanl at openjdk.org
Sat Nov 29 00:37:01 UTC 2025
On Fri, 28 Nov 2025 15:42:17 GMT, Ziad El Midaoui <zelmidaoui at openjdk.org> wrote:
>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxListViewSkin.java line 459:
>>
>>> 457: if (cell == buttonCell) {
>>> 458: final String promptText = comboBox.getPromptText();
>>> 459: if (comboBox.getValue() == null
>>
>> is the `comboBox.getValue()` check needed? Asking, as we are in here only if `empty` is true, so maybe this is not needed to check?
>
> The empty it is for the cell, `comboBox.getValue()` check the value of the control `ComboBox`. I think it's a good check to add to make sure it works when the value of the ComboBox is `null`
So I did some tests and when the condition `empty && cell == buttonCell` is true, `comboBox.getValue()` is always null.
And that is what I mean, it seems that the `comboBox.getValue() == null` condition is not needed to fix this bug. It probably doesn't hurt though, so I think it is more safe to keep it in I guess.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1989#discussion_r2572688456
More information about the openjfx-dev
mailing list