Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Robot.createScreenCapture() dual monitor and Xorg server

807588Jun 5 2009 — edited Jun 6 2009
update: if I specify a negative number for x it works. ei screen size=2306x1280 and the screen are 1024x768 / 1280/1024 screenRobot.createScreenCapture(-1024, 0, 2306, 1280) works.

I have noticed on newer linux distros (Xorg server) the Robot createScreenCapture gets a wrong representation of the screen. Monitor 1 is not captured, Monitor 2 is captured and placed on the left and the remaining space to the right is blank (black).

Good capture with Xorg (Fedora 8)
[mon1][mon2]

Capture with F9/10/11 (Xorg server)
[mon2][blank]

The screen dimensions are correctly reported by Toolkit.getDefaultToolkit().getScreenSize() in both cases.

Has anyone seen this and found a solution?

TIA

This is the textbook example that can be used to duplicate the problem.
        
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        System.out.println("capture: w:" + dim.width + " h:" + dim.height);
        try
        {
            Robot aRobot = new Robot();
            BufferedImage backgroundImage = aRobot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
            JAI.create("filestore", backgroundImage, "screen-shot.png", "PNG");
        } catch (AWTException awte)
        {
            System.out.println("robot excepton occurred");
        }
Edited by: zx5000 on Jun 5, 2009 11:10 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2009
Added on Jun 5 2009
1 comment
220 views