JavaFX获取屏幕尺寸

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();
posted @ 2020-05-31 11:57  氷泠  阅读(1086)  评论(0编辑  收藏  举报