-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
None
-
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.
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.
- duplicates
-
JDK-8098040 Add possibility to calculate and set window minimum and maximum size automatically
- Closed