JavaFX window sizing

空扰寡人 提交于 2019-12-11 16:33:16

问题


My app looks different at same OS. This is Windows 7 rich interface:

And Windows 7 regular interface:

The only thing that makes me angry is sizing. In FXML it's 640x445, but Windows 7 makes it wider. How can I avoid that? Is there an approach to make TextArea fullscreen or something?


回答1:


To resize your stage at initialize you can use following code (i assume you use javafx-2?)

//stage.setResizable(true);

Screen screen = Screen.getPrimary();    
Rectangle2D bounds = screen.getVisualBounds();

stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());

or you can use fullscreen mode:

stage.setFullScreen(true);


来源:https://stackoverflow.com/questions/23491944/javafx-window-sizing

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