JavaFX获取屏幕尺寸

45次阅读

共计 284 个字符,预计需要花费 1 分钟才能阅读完成。

1 awt

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double width = screenSize.getWidth();
double height = screenSize.getHeight();

2 javafx

Rectangle2D screenRectangle = Screen.getPrimary().getBounds();
double width = screenRectangle.getWidth();
double height = screenRectangle.getHeight();

正文完
 0