Mercurial > hg > Members > nobuyasu > tightVNCProxy
diff src/test/screen2image.java @ 164:28cd6a6c524d
add screen capture example
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 19 Oct 2011 11:57:14 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/screen2image.java Wed Oct 19 11:57:14 2011 +0900 @@ -0,0 +1,23 @@ +package test; + +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.io.File; + +import javax.imageio.ImageIO; + +public class screen2image +{ + public static void main(String[] args) throws Exception + { + Robot robot = new Robot(); + BufferedImage screenShot = null; + for(int i = 0; i<10;i++) { + screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); + System.err.println("done"); + } + ImageIO.write(screenShot, "JPG", new File("screenShot.jpg")); + } +} \ No newline at end of file