I have two screens plugged on my computer. I try to make a screen capture on each screen. I'm using the following code :
GraphicsDevice[] screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); //same screens[] with JRE7 and JRE8
Robot rbt0 = new Robot(screens[0]);
BufferedImage image0 = rbt0.createScreenCapture(new Rectangle(0,0,1024,1024));
Robot rbt1 = new Robot(screens[1]);
BufferedImage image1 = rbt1.createScreenCapture(new Rectangle(0,0,1024,1024));
The javadoc doesn't mention there is a new feature about Robot class on JRE8. Is this a bug of the JRE8 ? Is anyone having the same problem ? If this bug is confirmed, how could I communicate this problem to Oracle ?
Thanks everyone,
Regards,
It appears the way screen coordinates are calculated by the Robot have changed.
The following bug has been raised against the javadoc of Java 8 which may explain your problem.
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8033128
It looks like the change was made deliberately and is not a bug.
To capture your second screen you may have to offset the location by the size of the first screen.
Robot rbt1 = new Robot(screens[1]);
BufferedImage image1 = rbt1.createScreenCapture(new Rectangle(1024,0,1024,1024));