Hi guys..

The method createScreenCapture() in Robot class made me to post this question.
The method works absolutely fine and it does the functionality of capturing screen as it asked to do. Now the problem comes here when i take the snapshot of my screen while i play a game.
Why cant the method not able to capture the screen when i play a game...
Whats happening..

redirect capture screen to the BackGroung Task for example Runnble#Thread, SwingWorker, or for periodical Executor & java.util.Timer, succes with plain java.util.Timer is possible, but is ugly (my view), then GUI lives separate life, doeasn't freeze or waits for something ends

That's what i did...
My application takes snapshot and stores the image for every 30 seconds running in background..
Everything works fine but If i play a game then it will cant capture....

I mean the program sleeps() for 30 seconds and captures the screen for every 30 seconds.
But my problem is not about how to make it background.

The real issue is that it is unable to take the snapshot when i play a Game.
A black image is captured when it captures while i am playing a game.
When i do some other task (such as watching movies, browsing etc) , it does its job and there is no problem.

Can you spot the reason and tell me the solution..

What software is drawing to the screen when the Robot class gets a black image?
Is the whole screen being drawn to or just a frame on the screen?

What software is drawing to the screen when the Robot class gets a black image?

It is just a full screen game.

My problem is half-solved...
I made it to capture the game with slight changes.

Previous code:-

Dimension screenDims = Toolkit.getDefaultToolkit().getScreenSize();
  Rectangle screenRect = new Rectangle(0,0, screenDims.width, screenDims.height);

After changing the width and height as follows --

Rectangle screenRect = new Rectangle(0,0, 800,600);

Now , it works ..

What happened is that any game when shifted to full screen mode will reduces its pixels value .

I still thing that you mixing some methods together, there I can't see any reason for that,

but why bothering with something terrible as is Robot, Robot is for touching Native OS rellates ...., then could be solve more simpler and confortable if you'll reading 2D Graphics, all JComponets pretty return rendered contex to the some of 2D Graphics methods, hint if you print content of JComponent to the Printer then Java at firts returns non-scalled 2D Graphics ...

This article has been dead for over six months. Start a new discussion instead.