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

Invalid size of the ComboBoxPopupList if you specify fx-skin and fx-cell-size for styleclass .list-cell

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Setting a skin and cell size in a stylesheet for the list-cell styleclass leads to a wrong computation of the popuplist of a combobox if you open it for the first time

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      * set a skin and cell-size for .list-cell in the css-file
      * use a combobox in an appliation that contains e.g 4 items
      * run the application and open the popuplist of the combobox

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected result would be that the popuplist shows all 4 entries without a scrollbar
      ACTUAL -
      The populist shows two and a half entry with a vertical scrollbar

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      css - file:

      .list-cell {
         -fx-skin: "javafx.scene.control.skin.ListCellSkin";
         -fx-cell-size: 40px;
      }
      -----------------
      Testapplication:
      public class Main extends Application {
         @Override
         public void start(Stage primaryStage) {
            try {
               AnchorPane root = new AnchorPane();
               Scene scene = new Scene(root, 400, 400);
               scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());

               ComboBox<String> combo = new ComboBox();
               combo.getItems().addAll("entry 1", "entry 2", "entry 3", "entry 4");
               root.getChildren().add(combo);

               primaryStage.setScene(scene);
               primaryStage.show();
            } catch (Exception e) {
               e.printStackTrace();
            }
         }

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


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

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: