RFR: 8296653: ComboBox promptText is not displayed when the value is reset [v2]
Marius Hanl
mhanl at openjdk.org
Thu Nov 27 17:40:05 UTC 2025
On Thu, 27 Nov 2025 14:42:18 GMT, Ziad El Midaoui <zelmidaoui at openjdk.org> wrote:
>> The issue occurred because the skin marks the button cell as “empty” when the value becomes null.
>> With the fix clearing the ComboBox value re-shows the prompt text.
>> Tested using the code present in the bug.
>
> Ziad El Midaoui has updated the pull request incrementally with two additional commits since the last revision:
>
> - Remove space
> - Added Test and fixed comment
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?
modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 1317:
> 1315: @Test
> 1316: public void testPromptTextRestoredAfterSetValueNull() {
> 1317: comboBox.setPromptText("Select Value");
I would suggest to have a `String` variable with `"Select Value"` as value. And then use it here and the other two occurrences
modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 1323:
> 1321: sl = new StageLoader(comboBox);
> 1322: comboBox.applyCss();
> 1323: comboBox.show();
`applyCss` and `show` are not needed, should be removed
modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 1331:
> 1329: sm.select(2);
> 1330: Toolkit.getToolkit().firePulse();
> 1331:
An assert that the `buttonCell` is not `Select Value` would make sense here (`assertNotEquals`)
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1989#discussion_r2569626077
PR Review Comment: https://git.openjdk.org/jfx/pull/1989#discussion_r2569611338
PR Review Comment: https://git.openjdk.org/jfx/pull/1989#discussion_r2569612489
PR Review Comment: https://git.openjdk.org/jfx/pull/1989#discussion_r2569621239
More information about the openjfx-dev
mailing list