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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • None
    • javafx
    • ALL

      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.

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

              Created:
              Updated:
              Resolved:
              Imported: