I am working on a programm which needs to find objects on a screen, works fine so far, but I got a problem with multi-monitor configurations.
The GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()-class is able to give almost all details I need to define my search-area over multiple Screens but not the order of the devices. (e.g. secondary monitor is right of primary).
Therefore I am looking for a way to find out the screen-locations of primary and secondary monitors in, Java.
You can try reading
GraphicsDevice.html#getIDstring()value to determine ID of the monitor.Gives this for me:
Remember, that sometimes secondary monitor can be to the left of the primary. In this case, it will have negative bounds.
In order to determine whole bounds of the screen area, you can use an example, provided at the JDK Javadocs site:
GraphicsConfiguration