RFR: 8325564: ComboBox popup does not correctly resize after update when on display

Andy Goryachev angorya at openjdk.org
Tue Jan 27 18:42:39 UTC 2026


On Tue, 27 Jan 2026 18:23:58 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Fixed popup size not changing to show more items or less when changing the number of items in `ComboBox` by adding a `popupResize` variable which triggers a request layout when there is change in items list.
>> Tested with the test app in bug and MonkeyTester.
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java line 560:
> 
>> 558: 
>> 559:         final Node popupContent = getPopupContent();
>> 560:         if (popupResize && popupContent instanceof Region) {
> 
> minor stylistic suggestion:
> 
>         if (popupResize && popupContent instanceof Region r) {
>             r.setMinSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
>             r.setPrefSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
>         }

also, look in `sizePopup()`, there is `if (popupContent instanceof Region) {` with the `else` clause which handles other cases.  

Should any possible fix be in `sizePopup()` instead?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2052#discussion_r2733314457


More information about the openjfx-dev mailing list