关于Java+;windows 8,当使用并排应用程序和多屏幕应用程序时,如何获得可用的屏幕边框?

关于Java+;windows 8,当使用并排应用程序和多屏幕应用程序时,如何获得可用的屏幕边框?,java,swing,windows-8,multiscreen,Java,Swing,Windows 8,Multiscreen,在应用程序中的某个时刻,我需要获得屏幕的整个可用区域(没有工具栏,在Windows8中,是并排应用程序)。这是通过以下两种方式完成的 GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); 或者,如果你想直接做的话 GraphicsConfiguration gc = myGraphicsDevice.getDefaultConfiguration(); Insets inse

在应用程序中的某个时刻,我需要获得屏幕的整个可用区域(没有工具栏,在Windows8中,是并排应用程序)。这是通过以下两种方式完成的

      GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
或者,如果你想直接做的话

 GraphicsConfiguration gc = myGraphicsDevice.getDefaultConfiguration();
    Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
    Rectangle usableBounds = gc.getBounds();
    usableBounds.x += insets.left;
    usableBounds.y += insets.top;
    usableBounds.width -= (insets.left + insets.right);
    usableBounds.height -= (insets.top + insets.bottom);
(这与SunGraphicsEnviroment执行第一次操作的方式完全相同)

我遇到的问题是,当我在单屏幕上时,getScreenInsets()会正确地考虑并行应用程序(得到类似java.awt.Insets[top=0,left=971,bottom=48,right=0]的结果)。但是,如果我在一个多屏幕环境中,两个屏幕都显示左=0的插入(java.awt.insets[top=0,left=0,bottom=60,right=0])


getInsets在多屏幕上的使用应该有所不同,还是这是一个Java问题?我使用的是1.7v40。我在Oracle bug数据库中也没有找到类似的东西

回答自己:是的。这是一个Java错误

如果需要这样做,您需要使用本机代码并使用Windows API或等待Java补丁