Hi,
Is there any standard way to calculate the preferred size for Scene,
Node/Pane and Stage/Window?
I want once a form/pane is visualized, it cannot be minimized to a certain
size. Since I did not find such a built-in opportunity, at the moment I am
doing the following:
Scene scene = new Scene(gridPane);
primaryStage.setScene(scene);
primaryStage.sizeToScene();
primaryStage.show();
primaryStage.setMinWidth(primaryStage.getWidth() + 1);
primaryStage.setMinHeight(primaryStage.getHeight() + 1);
primaryStage.setWidth(640);
primaryStage.setHeight(480);
primaryStage.show();
The first call to primaryStage.show() (in orange) I do to calculate the
minimum panel size (Scene/GridPane), then set that size as minimum on
primaryStage, and finally set the size I want and visualize the panel again.
The unpleasant side effect is, that the panel is no longer at the center of
the screen.
Any ideas?
Regards,
Miro.