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

ComboBox dropdown list drops out of screen at 1024*768 resolution

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 8u66
    • javafx
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Set screen resolution to 1024*768

      A DESCRIPTION OF THE PROBLEM :
      The combobox popup is misplaced the first time the combobox is clicked on, at screen resolution 1024*768. The popup will go outside of the bottom of the screen. The second time it is clicked on it is placed correctly.

      REGRESSION. Last worked in version 7u80

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run source code provided at screen resolution 1024*768 with supplementary style.css.(source provided below)



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The popup aligns itself inside the screen edges
      ACTUAL -
      The popup is partly unreachable the first time and places itself correctly the second time

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ===================
      style.css (used by java code)
      ===================

      .combo-box-popup .list-view .list-cell{
          -fx-cell-size: 50;
      }


      ==============================
      ComboBoxMisplacementDemo.java
      ==============================
      import javafx.application.Application;
      import static javafx.application.Application.launch;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ComboBox;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class ComboBoxMisplacementDemo extends Application {
          
          
          @Override
          public void start(Stage primaryStage) {
              ComboBox<Integer> comboBox = new ComboBox();
              comboBox.setVisibleRowCount(9);
              for(int i = 1; i < 10; i++){
                  comboBox.getItems().add(i);
              }
              StackPane root = new StackPane();
              root.getChildren().add(comboBox);
              Scene scene = new Scene(root, 1024, 768);
              scene.getStylesheets().add(ComboBoxMisplacementDemo.class.getResource("/style.css").toExternalForm());
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }
          
      }



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

      CUSTOMER SUBMITTED WORKAROUND :
      This custom skin is a temporary workaround:

      public class FixedComboBoxListViewSkin<T> extends ComboBoxListViewSkin<T> {

          ComboBox<T> thisComboBox;

          public FixedComboBoxListViewSkin(final ComboBox<T> comboBox) {
              super(comboBox);
              thisComboBox = comboBox;

              //Used to set a fixed height of the cells in the popup-list. This is a fix
              //to cope with the fact that the popup/list will get a too large height and
              //be positioned below the bottom of the screen in some cases when running
              //on a 1024x768 screen
              ListView listView = (ListView) getPopupContent();
              listView.setFixedCellSize(50);
              listView.autosize();

          }

      }


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: