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

Spinner within gridpane has unintended resize effects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8u65
    • javafx
    • x86_64
    • windows_7

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Development environment: NetBeans IDE 8.0.2

      A DESCRIPTION OF THE PROBLEM :
      When I use the Spinner component in a GridPane, and every item in it has to grow always and has its max size set to Double.MAX_VALUE, there are some unexplainable resize effects: whenever the Spinner component gets focus, or the value changes, it grows a bit, until the other components are on theirs minimum size.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Execute the provided executable test code.
      - Click into the spinner component.
      - Press Tab several times

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The spinner doesn't resize, since it has enough space to display the entered data.
      ACTUAL -
      The spinner grows in size until the combobox has reached its minimum size.

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

        @Override
        public void start(Stage primaryStage)
        {
          ChoiceBox<String> box = new ChoiceBox<>();
          box.getItems().add("Item 1");
          box.setMaxWidth(Double.MAX_VALUE);
          GridPane.setHgrow(box, Priority.ALWAYS);

          Spinner spinner = new Spinner(1, 365, 1);
          spinner.setMaxWidth(Double.MAX_VALUE);
          GridPane.setHgrow(spinner, Priority.ALWAYS);

          GridPane gridPane = new GridPane();
          gridPane.setHgap(5);
          gridPane.setVgap(5);
          gridPane.setPadding(new Insets(5));
          gridPane.addRow(0, box, spinner);

          Scene scene = new Scene(gridPane, 1000, 400);
          primaryStage.setTitle("Spinner in GridPane");
          primaryStage.setScene(scene);
          primaryStage.show();
        }

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

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: