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

GridPane not honoring preferred width of child when other child in same column has smaller max size

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • fx2.0
    • fx2.0
    • javafx
    • Mac OS X 10.5.8, JavaFX Beta Build 21

      The following code doesn't show the contents of the HBox (note that this is true even when you remove the setMaxHeight calls),

      Button v = new Button("FOO");
      v.setMaxHeight(Double.MAX_VALUE);

      HBox infoLine = new HBox();
      Label timeDisplay = new Label("AAA");
      Label resultCount = new Label("BBB");
      Label status = new Label("CCC");
      infoLine.getChildren().addAll(timeDisplay, resultCount, status);
      infoLine.setMaxHeight(Control.USE_PREF_SIZE);

      GridPane view = new GridPane();
      GridPane.setConstraints(v, 0, 0);
      GridPane.setConstraints(infoLine, 0, 1);
      GridPane.setVgrow(v, Priority.ALWAYS);
      GridPane.setHgrow(v, Priority.ALWAYS);
      GridPane.setVgrow(infoLine, Priority.NEVER);
      GridPane.setHgrow(infoLine, Priority.NEVER);
      view.getChildren().addAll(v, infoLine);

      Scene sx = new Scene(view, 300, 500);
      stage.setScene(sx);
      stage.setVisible(true);

            amfowler Anne Fowler (Inactive)
            gmatthewsjfx Graham Matthews (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: