Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8325564

ComboBox popup does not correctly resize after update when on display

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx11, 8, jfx17, jfx21, jfx22
    • javafx
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      RedHat Linux 8u6

      A DESCRIPTION OF THE PROBLEM :
      When a ComboBox has items updated whilst on display subsequent updates to the item list are not taken into account when resizing the popup.

      The popup remains at the original size even if the new list of items is longer. This is a usability issue if going from a shorter to a longer list - the user cannot see the options and are troublesome to select via a single line scrollable pane. When going from a longer to shorter list the popup contains dead-space.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the attached test case
      2. Press the "Update" button
      3. Wait 5 seconds
      4. Interact with the ComboBox

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Popup to be sized to show all the options without any scrolling.
      ACTUAL -
      ComboBox popup is only 1 cell high and not big enough to use effectively.
      The options are shown but you have to navigate to them with an impossibly small ScrollPane
      ComboBox remains in 'broken' stage even after selecting an option.

      ---------- BEGIN SOURCE ----------
      import javafx.animation.KeyFrame;
      import javafx.animation.Timeline;
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ComboBox;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;
      import javafx.util.Duration;

      public class ComboBoxPopupSizeIssue extends Application {

          @Override
          public void start(Stage stage) throws Exception {
              ComboBox<String> comboBox = new ComboBox<>();
              Timeline animation = new Timeline();
              animation.getKeyFrames().add(new KeyFrame(Duration.seconds(1), event -> {
                  comboBox.show();
                  comboBox.getItems().setAll("Dave");
              }));
              animation.getKeyFrames().add(new KeyFrame(Duration.seconds(2), event -> {
                  comboBox.getItems().setAll("Rigby 1", "Rigby 2", "Rigby 3", "Rigby 4", "Rigby 5");
              }));

              Button update = new Button("Update");
              update.setOnAction(event -> animation.playFromStart());
              stage.setScene(new Scene(new VBox(comboBox, update)));
              stage.setWidth(200);
              stage.setHeight(200);
              stage.show();
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Unknown

      FREQUENCY : always


            angorya Andy Goryachev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: