Calculate preferred size and set as minimum
mnachev.nscenter.eu at gmail.com
Thu Aug 23 14:34:30 UTC 2018
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.setMinWidth(primaryStage.getWidth() + 1);
primaryStage.setMinHeight(primaryStage.getHeight() + 1);
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
More information about the openjfx-dev