JDK-7168628 : Robot.createScreenCapture() does not capture all windows
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u24
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2012-05-14
  • Updated: 2012-10-09
  • Resolved: 2012-06-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6-poolResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK Server VM (build 20.0-b12, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux druk 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:52 UTC 2012 i686 i686 i386 GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
Ubuntu 12.04. Unity-2D desktop environment

A DESCRIPTION OF THE PROBLEM :
When performing a screen capture using Robot.createScreenCapture(...) some windows are not captured correctly on Linux.

When running Ubuntu 12.04 with the unity-2d desktop (default fallback for non-3d accelerated systems) the only things that are captured are the dash and menu bars.

If the full unity (3d accelerated version) desktop is used then windows seem to get captured correctly.

Under KDE windows are captured correctly but the taskbar and K menu seem to have transparency issues.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Select 'Ubuntu 2D' at the Ubuntu login screen. Attempt to perform a screen capture using a Java application.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The full screen with all application windows should be captured.
ACTUAL -
Only the dash and menu bars are captured; the rest of the screen capture is black.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
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();
    }
  }
}
---------- END SOURCE ----------