How to use GraphicsEnvironment to detect display mirroring?

I use the following code to check the number of screens and select the largest one to display my application. However, I still do not have time to detect cases when displays are mirrored instead of extended ones. Is there any way I can do this?

if (GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices().length > 1) {
    findBiggestScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()).setFullScreenWindow(this);
} else {
    GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(this);
}
+3
source share
1 answer

I cannot verify this because I do not have a second display, but maybe you can try GraphicsDevice # getDefaultConfiguration () # getBounds () .

Javadoc is not explicitly mentioned, but I think that mirror screens have equal values ​​for the x and y offsets.

0
source

All Articles