United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4691481 : Mouse cursor not visible when using Robot.createScreenCapture()

Details
Type:
Bug
Submit Date:
2002-05-24
Status:
Resolved
Updated Date:
2003-05-25
Project Name:
JDK
Resolved Date:
2003-05-25
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
5.0 (tiger)

Related Reports

Sub Tasks

Description

Name: jk109818			Date: 05/24/2002


FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

FULL OPERATING SYSTEM VERSION :Red Hat Linux 7


A DESCRIPTION OF THE PROBLEM :
I used this code to create a screencapture application


import java.awt.*;
import java.awt.Image.*;
import javax.imageio.*;
import java.io.*;
public class test{
public static void main(String args[]){
try{
Robot tt=new Robot();
Rectangle screen=new Rectangle(1024,768);
File f1 = new File("/home/hari/java/test.jpg");
javax.imageio.ImageIO.write(tt.createScreenCapture(screen),"jpg",f1);
}catch(Exception e){System.out.println(e);}
}
}


This code returned me the screencapture of my desktop but i
just don't see the mouse arrow in the jpeg that it produced
don't you think it's a bug????

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run this code

import java.awt.*;
import java.awt.Image.*;
import javax.imageio.*;
import java.io.*;
public class test{
public static void main(String args[]){
try{
Robot tt=new Robot();
Rectangle screen=new Rectangle(1024,768);
File f1 = new File("/home/hari/java/test.jpg");
javax.imageio.ImageIO.write(tt.createScreenCapture(screen),"jpg",f1);
}catch(Exception e){System.out.println(e);}
}
}



2.Now check the jpg image
3.

EXPECTED VERSUS ACTUAL BEHAVIOR :
I would like to see every activity on my desktop when i
screencapture my desktop but i see everything other then
mouse pointer

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.Image.*;
import javax.imageio.*;
import java.io.*;
public class test{
public static void main(String args[]){
try{
Robot tt=new Robot();
Rectangle screen=new Rectangle(1024,768);
File f1 = new File("/home/hari/java/test.jpg");
javax.imageio.ImageIO.write(tt.createScreenCapture(screen),"jpg",f1);
}catch(Exception e){System.out.println(e);}
}
}
---------- END SOURCE ----------
(Review ID: 145457) 
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b08


                                     
2004-06-14
EVALUATION

The mouse cursor is not included in screen captures on Solaris, Windows 2000, or RedHat Linux 7.2 using 1.4, 1.4.1, and 1.4.2b19.  This is also true of 1.4.1 on Mac OS X.  This is not a bug.  But, I'll make this explicit in the docs.
###@###.### 2003-04-10
                                     
2003-04-10
SUGGESTED FIX

------- Robot.java -------
*** /tmp/sccs.m_aaBg    Thu Apr 10 17:41:55 2003
--- Robot.java  Thu Apr 10 17:41:51 2003
***************
*** 254,260 ****
      }
  
      /**
!      * Creates an image containing pixels read from the screen.
       * @param screenRect      Rect to capture in screen coordinates
       * @return        The captured image
       * @throws        IllegalArgumentException if <code>screenRect</code> width and height are not greater than zero
--- 254,261 ----
      }
  
      /**
!      * Creates an image containing pixels read from the screen.  This image does
!      * not include the mouse cursor.
       * @param screenRect      Rect to capture in screen coordinates
       * @return        The captured image
       * @throws        IllegalArgumentException if <code>screenRect</code> width and height are not greater than zero
###@###.### 2003-04-10
                                     
2003-04-10



Hardware and Software, Engineered to Work Together