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

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


On Mon, 26 Jan 2026 21:36:46 GMT, Ziad El Midaoui <zelmidaoui 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.

The fix does not look right: I don't think the new flag is needed, but instead the popup should be properly sized.

On top of that, the fixed code does not work: the first update shows a tiny popup where most of the area is covered with scrollbars, and the second update (after 2 seconds) still displays scrollbars.  The scrollbars should not be there at all:

<img width="233" height="217" alt="Image" src="https://github.com/user-attachments/assets/68d24cbd-04ed-4860-a2c8-35e1bff4646a" />

<img width="259" height="237" alt="Image" src="https://github.com/user-attachments/assets/9032f237-2e50-4431-a202-d1397337b5eb" />

(on macOS retina, scale=2)

there is more: on an external monitor at scale=1, if I press the [Update] button then quickly click on the combo box, the popup is shown but very small, and it does not change:

<img width="244" height="213" alt="Image" src="https://github.com/user-attachments/assets/72f637dc-5117-4fa0-902e-2b3703c8d513" />

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);
        }

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java line 594:

> 592:     }
> 593: 
> 594:     final void requestPopupLayout() {

misnomer: the name suggests it's a request, but in fact it does much more by calling

reconfigurePopup();
sizePopup();

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

Changes requested by angorya (Reviewer).

PR Review: https://git.openjdk.org/jfx/pull/2052#pullrequestreview-3712782266
PR Review Comment: https://git.openjdk.org/jfx/pull/2052#discussion_r2733288104
PR Review Comment: https://git.openjdk.org/jfx/pull/2052#discussion_r2733293716


More information about the openjfx-dev mailing list