On Wed, 10 Jun 2026 21:24:40 GMT, Christopher Schnick <[email protected]> 
wrote:

>> This is a much simpler fix for JDK-8384806 which does not have any side 
>> effects.
>> 
>> This restores the old code with only a one line change instead. For 
>> reference, see 
>> https://github.com/openjdk/jfx/commit/8d917ae738120e12ac12cd0957879b7c00e59b03.
>>  We now fix the issue by clearing the cell with 
>> `buttonCell.updateIndex(-1);` as using `buttonCell.setItem(null);` was 
>> causing the original issue when the item was already null.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Christopher Schnick has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Split test method

modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java
 line 603:

> 601: 
> 602:         // Calls updateDisplayNode()
> 603:         getDisplayNode();

This looks a bit weird - but should be the `buttonCell`, right?

So you may can just do: `ListCell<?> buttonCell = getDisplayNode()`
and then use it below for the assertions

        assertNotNull(buttonCell.getGraphic());
        assertEquals("null-text", ((Label) buttonCell.getGraphic()).getText());

        comboBox.setValue("ITEM1");
        assertEquals("ITEM1", ((Label) buttonCell.getGraphic()).getText());

        comboBox.setValue("ITEM2");
        assertEquals("ITEM2", ((Label) buttonCell.getGraphic()).getText());

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2179#discussion_r3391857141

Reply via email to