API enhancement request to make stage respect scene's min size
Martin Sladecek
martin.sladecek at oracle.com
Thu Jun 26 11:27:21 UTC 2014
Hi Robert,
I think this is the JIRA issue you are looking for:
https://javafx-jira.kenai.com/browse/RT-19183
This might be a good candidate for 8u40 actually...
-Martin
On 06/26/2014 01:10 PM, Robert Krüger wrote:
> Hi,
>
> right now, I am doing this to prevent stage windows to be resizable in
> a way that cuts off their contained scene's content:
>
> final Scene scene = new Scene(pane);
> stage.setScene(scene);
> stage.setTitle(getClass().getSimpleName());
> stage.sizeToScene();
>
> // ensure that the window can not be resized to smaller than
> the minsize of its scene
> Runnable updateMinSize = () -> {
> stage.setMinWidth(scene.getRoot().minWidth(scene.getHeight()));
> stage.setMinHeight(scene.getRoot().minHeight(scene.getWidth())
> + DECORATIONS_HEIGHT);
> };
>
> stage.setOnShown((e) -> updateMinSize.run());
> stage.widthProperty().addListener((obs, oldVal, newVal) ->
> updateMinSize.run());
> stage.heightProperty().addListener((obs, oldVal, newVal) ->
> updateMinSize.run());
> stage.show();
>
> This feels somewhat odd (and the constant for window decoration's
> height is ugly but maybe I am missing the clean way to retrieve it)
> for something that should be a common requirement (in all of our
> applications it is usually considered a bug when a window/dialog does
> not enforce this).
>
> Shouldn't there be a method like
> stage.setRespectContentMinSize(boolean respect) or something similar?
> Am I missing something obvious that is already there?
>
> Thanks for any insights.
>
> Robert
More information about the openjfx-dev
mailing list