java:取屏幕大小(去掉任务栏的高度部分)

时间:2021-12-02 08:51:13
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();

Insets   screenInsets   =   Toolkit.getDefaultToolkit().getScreenInsets(frame.getGraphicsConfiguration());
Rectangle desktopBounds = new Rectangle(
screenInsets.left, screenInsets.top,
screenSize.width - screenInsets.left - screenInsets.right,
screenSize.height - screenInsets.top - screenInsets.bottom);

上面这个方法是在网上搜索到的,

真是山外有山,人外有人。

2007-11-02