java 获取屏幕的分辩率
public static Rectangle getDestktopRectangle() {
Rectangle windowSize = new Rectangle();
Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
Insets scrInsets = Toolkit.getDefaultToolkit().getScreenInsets(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration());
//获取屏幕可以利用的width和height
//windowSize.setBounds(scrInsets.left, scrInsets.top, scrSize.width - scrInsets.left - scrInsets.right, scrSize.height - scrInsets.top - scrInsets.bottom);
//获取屏幕的分辨率
windowSize.setBounds(scrInsets.left, scrInsets.top, scrSize.width, scrSize.height);
System.out.println("The desktop resolution is : " + windowSize);
return windowSize;
}