Saturday, January 09, 2010

Screen Capture in Java

Just 3 lines of Java code can capture your screen and transfer the data through wire or store to disk. If an effective algorithm is put in place, an efficient platform independent remote desktop sharing can be build. Refer to jrdekstop an open source project that uses this technique.

Try it your self,

public static void main(String[] args) throws Exception {
Robot rt = new Robot();
BufferedImage img = rt.createScreenCapture(new Rectangle(1000,1000));
ImageIO.write(img, "png", new File("D:\\tmp.png"));
}
Refer to this java world article about screen capture - http://www.javaworld.com/javaworld/jw-04-2006/jw-0424-funandgames.html

Checkout In Dzone

No comments: