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

ComboBox popup is in wrong location on first showing

XMLWordPrintable

    • x86_64
    • windows

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "22.0.1" 2024-04-16
      OpenJDK Runtime Environment (build 22.0.1+8-16)
      OpenJDK 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      ComboBox popup is in wrong location on first showing when it is at the bottom of the screen

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the provided code. When you run it, the window will be maximized. Don't minimize it, as ComboBox should be at the bottom of the screen. Click ComboBox for the first time. Note popup position. Click ComboBox for the second time. See the difference.


      ACTUAL -
      You will see that positions of the fist popup and of the second popup are different. See https://postimg.cc/HcwhdX7f

      ---------- BEGIN SOURCE ----------
      public class ComboBoxTest extends Application {

          @Override
          public void start(Stage stage) {
              var items = FXCollections.observableArrayList(List.of("a", "b"));
              var combobox = new ComboBox<String>();
              combobox.setItems(items);

              var vBox = new VBox(combobox);
              vBox.setStyle("-fx-font-size: 15");
              vBox.setAlignment(Pos.BOTTOM_LEFT);

              Scene scene = new Scene(vBox, 600, 200);
              var css= this.getClass().getResource("test.css").toExternalForm();
              scene.getStylesheets().add(css);
              stage.setScene(scene);
              stage.show();
              stage.setMaximized(true);
          }

          public static void main(String[] args) {
              launch();
          }
      }

      .combo-box-popup .list-cell {
          -fx-padding: 0 10 0 10;
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        1. Test.java
          1.0 kB
        2. Ubuntu.mp4
          6.76 MB
        3. Windows.gif
          Windows.gif
          19 kB

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

              Created:
              Updated: