We are trying to develop a screen capture utility.
How do we capture selected screen of another application using Java? And how do we add a callout to the captured screen?
We are trying to develop a screen capture utility.
How do we capture selected screen of another application using Java? And how do we add a callout to the captured screen?
Perhaps the java.awt.Robot class would help with the screen shots, although I do not think it is capable of locating individual windows. As for these "call outs", the Robot class can also invoke mouse clicks and key presses, if that is what you mean.
Based on Prajakta's description of the project, I believe some explanation of manipulating a screen shot is in order (I think John did an excellent job of explaining how to capture the screen shot using the java.awt.Robot class). Remember, as Steve McLeod said, Java may not be able to automatically locate the location of the window you want to capture on the screen. This is important, because the Robot class needs to know this location, either automatically or manually from you.
Callouts, text, images, etc can be added to the screen shot via the Graphics2D object you receive when you call the createGraphics() method of the screen shot's BufferedImage. I highly recommend you check out the Graphics2D's API to better understand what it is capable of. I also recommend finding some tutorials, perhaps starting with the the 2D Graphics Tutorial from Sun. The book entitled "Filthy Rich Clients" may also come in useful.
When you finally want to save this modified screen shot, you can use the one of the "write" methods of the ImageIO class.
Here is a very simple, start-to-finish example. It is up to you to fill in whatever details necessary.
I hope this help a little!
You will need to provide more specific information in order to receive meaningful help. To start with, Which operating systems does this need to work on? Do you need to capture the contents of individual windows or literally entire displays (you used the ambiguous term "selected screen of other application" in your original post). What specifically do you want to see when you "add callout to captured screen"?
With this code i could make screens of certain windows in windows10, dont forget the dependency.
Credits go to: Windows: how to get a list of all visible windows?
Code:
should get you a whole image of the whole screen. not sure if that gets you the whole things if you have multiple monitors, though...
Code for capturing screenshot in Java,
http://www.codinguide.com/2010/04/capture-screen-shot-from-java.html