JavaFX How to set max/min window size?

♀尐吖头ヾ 提交于 2019-11-28 11:17:20

I am going to assume that by window, you mean a Stage (which subclasses Window).

The window size can vary from the root container size for the scene. You can think of a window or stage as an independent viewport into the scene which can be sized larger or smaller than the min and max specifications of the scene root.

To set the minimum or maximum size of the Stage, set it's minHeight and minWidth or maxHeight and maxWidth properties.

Answers to additional questions

Can the Stage be set to "fit whole display" size?

stage.setFullScreen(true)

But how to make the size as same as we make size by clicking on the title bar?

stage.setMaximized(true)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!