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();
上一篇:要重写Object中的equals(Object obj)方法的应有姿势是这样的!附带代码演示


下一篇:18、配置嵌入式servlet容器(2)