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

Java.awt Robot createScreenCapture() fail to capture any popup dialog

XMLWordPrintable

    • x86_64
    • linux

      FULL PRODUCT VERSION :
      java version "1.8.0_101"
      Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      ubuntu 15.04 +
      fedora 22+


      A DESCRIPTION OF THE PROBLEM :
      Java awt Robot createScreenCapture() fail to capture any popup dialog box on *nix distro,

      The captured image will only contains the frame of the dialog box, but the content of the dialog box is virtually transparent.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Open Firefox
      2. Open the about dialog box
      3. capture screen shot using awt Robot

      similarily, open Eclipse IDE, open preference windows, capture screenshot

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Screen image is saved.
      Image should contains all visible UI elements on screen
      ACTUAL -
      the dialog box on the image is transparent
      the terminal windows border is removed

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
          public static void main(String[] args) {
              try {
                  Thread.sleep(3000); // wait 3 seconds
                  Robot robot = new Robot();
                  String format = "jpg";
                  String fileName = "FullScreenshot." + format;
                  
                  Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
                  BufferedImage screenFullImage = robot.createScreenCapture(screenRect);
                  ImageIO.write(screenFullImage, format, new File(fileName));
                  
                  System.out.println("A full screenshot saved!");
              } catch (Exception ex) {
                  System.err.println(ex);
              }
          }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      NONE ..

        1. 1.jpg
          101 kB
          Ajit Ghaisas
        2. 2.jpg
          169 kB
          Ajit Ghaisas
        3. FullScreenshot-8u101.jpg
          131 kB
          Abhijit Roy
        4. FullScreenshot-8u102.jpg
          160 kB
          Abhijit Roy
        5. FullScreenshot-9ea+126.jpg
          182 kB
          Abhijit Roy
        6. FullScreenshotDemo.java
          1 kB
          Abhijit Roy

            aghaisas Ajit Ghaisas
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: