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

Stage should automatically inherits its minimum size from the Scene's root node

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      ALL

      Description

      The Stage seems not to respect the minimum sizes from its content.

      If the following example, the Stage does not respect the minimum size set on the StackPane:


      public class TestMinSize extends Application {

          @Override
          public void start(Stage primaryStage) {
              Button btn = new Button();
              btn.setText("Say 'Hello World'");

              StackPane root = new StackPane();

              // set minimum size
              root.setMinWidth(200);
              root.setMinHeight(200);

              root.getChildren().add(btn);

              Scene scene = new Scene(root, 300, 250);

              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);

              primaryStage.show();
          }
      }


      The only way to "simulate" this was to use bindings such as:

              primaryStage.minHeightProperty().bind(((Pane)scene.getRoot()).minHeightProperty());
              primaryStage.minWidthProperty().bind(((Pane)scene.getRoot()).minWidthProperty());
      (code is incomplete since do not take into account Stage's decoration)

      I think the Stage should inherits its minimum size from its content such as the preferred size.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psafrata Pavel Ĺ afrata
                Reporter:
                anouardjfx arnaud nouard (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: