Java 如何使用GraphicsEnvironment检测显示镜像?

Java 如何使用GraphicsEnvironment检测显示镜像?,java,Java,我使用下面的代码检查有多少个屏幕,并选择最大的一个来显示我的应用程序。但是,我还没有成功地检测到显示器被镜像而不是扩展的情况。有什么办法我可以做到吗 if (GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices().length > 1) { findBiggestScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevi

我使用下面的代码检查有多少个屏幕,并选择最大的一个来显示我的应用程序。但是,我还没有成功地检测到显示器被镜像而不是扩展的情况。有什么办法我可以做到吗

if (GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices().length > 1) {
    findBiggestScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()).setFullScreenWindow(this);
} else {
    GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);
}

我不能测试这个,因为我没有第二个显示器可用,但也许你可以试试

javadoc中没有明确提到这一点,但我想镜像屏幕的x和y偏移量是相等的