javadisplaymultiple-monitors

Alignment of two different screens connected in dual-screen mode in a system


When two systems connected in dual mode one system will be the default system and other will extend right to it or to its left.

I want to programmatically find to which side does it extends. How is this found programmatically?

NB: My app runs on Java and I've already tried out the GraphicsEnvironment function.


Solution

  • Try it like this.

    GraphicsDevice[] g = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
             
    for ( GraphicsDevice gd : g) {
         System.out.println(gd.getDefaultConfiguration().getBounds());
    }
    

    The bounds should be representative of the relative position of the screen(s) to each other.