JC97
JC97

Reputation: 1620

JavaFx resizable

I'm making an javafx application that needs to be maximized, and not resizable. (I have to see the taskbar under the window, but I have fixed that). But when I set this:

spelStage.setResizable(false);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
spelStage.setX(primaryScreenBounds.getMinX());
spelStage.setY(primaryScreenBounds.getMinY());
spelStage.setWidth(primaryScreenBounds.getWidth());
spelStage.setHeight(primaryScreenBounds.getHeight());

It shows the way I want it (because with setMaximize(true) the taskbar disappears). But when you drag on the titlebar it still resizes the window smaller despites I say resizable false...

Any tips on how to make the window not resizable at all?

Thanks in advance!

Upvotes: 1

Views: 6847

Answers (1)

Maciej Dobrowolski
Maciej Dobrowolski

Reputation: 12140

If you just need to make window not resizeable then you can set resizeable property on stage to false:

spelStage.setResizable(false);

Please note that the window could still be moved by dragging titlebar.

This problem would be probably gone if you additionaly set window style to UNDECORATED:

spelStage.initStyle(StageStyle.UNDECORATED);

Upvotes: 2

Related Questions