Is there a way to capture the screen but without the app itself getting shown. I know how to minimize or make a frame invisible but this has to be done real fast cos it's going to happen alot in each second (at least once every second). I want it to look something like the magnifier in Windows Vista/7. (The app can see behind itself.)
Asked
Active
Viewed 2,303 times
3 Answers
3
Call setVisible(false)
on your main JFrame before capturing the screen. When the screen capturing process is finished, call setVisible(true)
to get your GUI showing up again.
To capture the screen, you can use the Robot class. It contains a createScreenCapture
method that receives rectangle coordinates which will be captured in a BufferedImage.

Cesar
- 5,488
- 2
- 29
- 36
-
I think the OP knows about this since 1, he writes "I know how to minimize or make a frame invisible", 2, the question is tagged with "robot". Furthermore "I want it to look something like the magnifier in Windows Vista/7" really indicates that his app can't be minimized when taking the screenshot. – aioobe May 06 '10 at 15:32
-
The not being minimized constraint is still met, since the app itself wouldn't be minimized. The OP's comment "but this has to be done real fast cos it's going to happen alot in each second" tells me that he thinks making it invisible wouldn't work due to the frequency of captures, which is not true. – Cesar May 06 '10 at 15:40
-
Ok. I see your point. You might want to change JForm to JFrame though... or am I misunderstanding anything else? – aioobe May 06 '10 at 15:50
-
1Well, setting the app invisible, capturing the screen and then setting the app visible again, all every 1 second will almost make the app unusable. – Auxiliary May 06 '10 at 16:09
1
This is not possible in Java without tight native integration with the window-manager of the platform in question.

aioobe
- 413,195
- 112
- 811
- 826