Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7168628

Robot.createScreenCapture() does not capture all windows

XMLWordPrintable

    • x86
    • linux

      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 ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: