Tuesday, October 29, 2013

Java program to take screen shots of your desktop

This example is used to take screen shots of your desktop and save the file in specific format in your machine. This example uses java.awt.Robot class to capture the screen pixels and returns a BufferedImage. Java.awt.Robot class is used to take the control of mouse and keyboard, see API for more options. Once you get the control, you can do any type of operation related to mouse and keyboard through your java code.

Please see the self explanatory java code below. This example takes screen shot of your desktop after an interval of every 5 second, you can customize it as per your requirement.