There are 2 monitors attached to my computer and I want to count them programmatically. How to do that with Java?
You simply click on the monitor that you want to be the primary monitor in settings>display, and then scroll down and select the box that says "Make this my main display".
To change the monitors' position, click, drag, and place the blue, numbered boxes to your preferred position. If you are unsure which monitor is "1" or "2," click the "Identify" link. The assigned monitor number will then appear on each monitor's screen. When finished, click [Apply].
Try next:
GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
System.out.println(localGraphicsEnvironment.getScreenDevices().length);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With