On Mon, 1 Jun 2026 01:43:45 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).

Reverting is fine and I agree updating the index is better then manually 
setting the item. @arapte suggested an improvement that I also would like to 
see.

I still think the `buttonCell` should be updated to -1. I don't think this 
affects the prompt text - in any case, we could agree to do that later as a 
follow up. We have many more tests in this area, and the code is less hacky, so 
overall a win.

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

> 523: 
> 524:         comboBox.setValue("ITEM1");
> 525:         assertEquals("ITEM1", ((Label) 
> comboBox.getButtonCell().getGraphic()).getText());

`getDisplayNode()`

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

PR Review: https://git.openjdk.org/jfx/pull/2179#pullrequestreview-4429603838
PR Review Comment: https://git.openjdk.org/jfx/pull/2179#discussion_r3357472781

Reply via email to