← Back to team overview

openjdk team mailing list archive

[Bug 999170] Re: Robot.createScreenCapture() does not work with unity-2d

 

Please give the solution to capture the image properly with out any
black screen. Is there any solution to capture the screen in java apart
from java.awt.Robot class.

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-6 in Ubuntu.
https://bugs.launchpad.net/bugs/999170

Title:
  Robot.createScreenCapture() does not work with unity-2d

Status in OpenJDK:
  New
Status in “openjdk-6” package in Ubuntu:
  Confirmed
Status in “openjdk-7” package in Ubuntu:
  Confirmed

Bug description:
  The built in Java screen grabber
  (java.awt.Robot.createScreenCapture(...)) does not work correctly with
  unity-2d. When attempting to create a screen capture for the whole
  screen only the dash and menu bars are captured - everything else is
  black. This only affects unity-2d not unity or KDE.

  Simple test case:

  import java.awt.*;
  import java.awt.image.BufferedImage;
  import java.io.File;
  import javax.imageio.ImageIO;

  public class ScreenGrab {
    public static void main(String[] args) {
      try {
        Rectangle grabRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
        Robot robot = new Robot();
        BufferedImage capture = robot.createScreenCapture(grabRect);
        ImageIO.write(capture, "PNG", new File("java-screen-shot.png"));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }

  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: openjdk-6-jre 6b24-1.11.1-4ubuntu2
  ProcVersionSignature: Ubuntu 3.2.0-24.37-generic 3.2.14
  Uname: Linux 3.2.0-24-generic i686
  ApportVersion: 2.0.1-0ubuntu7
  Architecture: i386
  Date: Mon May 14 15:51:34 2012
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
  ProcEnviron:
   LANGUAGE=en_GB:en
   TERM=xterm
   PATH=(custom, user)
   LANG=en_GB.UTF-8
   SHELL=/bin/bash
  SourcePackage: openjdk-6
  UpgradeStatus: Upgraded to precise on 2012-04-23 (20 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/openjdk/+bug/999170/+subscriptions


References