Mercurial > hg > Members > nobuyasu > tightVNCProxy
changeset 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 | 13458f88d8c9 |
children | 107b965effc1 |
files | .classpath src/test/screen2image.java |
diffstat | 2 files changed, 23 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/.classpath Wed Oct 12 06:45:04 2011 +0900 +++ b/.classpath Wed Oct 19 11:57:14 2011 +0900 @@ -3,11 +3,5 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="/Users/aotokage/testProgram/java/xml_rpc/apache-xmlrpc-3.1.3/lib/xmlrpc-client-3.1.3.jar"/> - <classpathentry kind="lib" path="/Users/aotokage/testProgram/java/xml_rpc/apache-xmlrpc-3.1.3/lib/xmlrpc-common-3.1.3.jar"/> - <classpathentry kind="lib" path="/Users/aotokage/testProgram/java/xml_rpc/apache-xmlrpc-3.1.3/lib/xmlrpc-server-3.1.3.jar"/> - <classpathentry kind="lib" path="/Users/aotokage/testProgram/java/xml_rpc/commons-codec-1.3.jar"/> - <classpathentry kind="lib" path="/Users/aotokage/testProgram/java/xml_rpc/apache-xmlrpc-3.1.3/lib/ws-commons-util-1.0.2.jar"/> - <classpathentry kind="lib" path="/Users/aotokage/testProgram/java/xml_rpc/apache-xmlrpc-3.1.3/lib/commons-logging-1.1.jar"/> <classpathentry kind="output" path="bin"/> </classpath>
--- /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