Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4691481
Votes 0
Synopsis Mouse cursor not visible when using Robot.createScreenCapture()
Category java:classes_awt
Reported Against 1.4
Release Fixed 1.5(tiger)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 24-MAY-2002
Description




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  xxxxx  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) 
======================================================================
Work Around
N/A
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.
 xxxxx@xxxxx  2003-04-10
Comments
  
  Include a link with my name & email   

Submitted On 09-APR-2003
SWP
This is not a bug.  Mouse pointers are not part of the screen that is captured - they are on top of it.  At best it would be platform specific.  If this API did have the mouse pointer in the image I would have to request a version that did not.
Pointers are usually implemented with a hardware sprite that simply is never drawn to the bitmap being displayed as the screen.


Submitted On 27-APR-2003
SPOON
I don't care if it is a bug or not, how can I work around, any 
suggestion?


Submitted On 05-FEB-2004
PatrikOlsson
Work around: Get the mouse position and draw your own mouse
pointer. 



PLEASE NOTE: JDK6 is formerly known as Project Mustang