JDK-4691481 : Mouse cursor not visible when using Robot.createScreenCapture()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2002-05-24
  • Updated: 2017-05-16
  • Resolved: 2003-05-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 Availabitlity Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
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

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

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