Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AWTException;
- import java.awt.Rectangle;
- import java.awt.Robot;
- import java.awt.Toolkit;
- import java.awt.image.BufferedImage;
- import java.io.File;
- import java.io.IOException;
- //import java.util.Scanner;
- import javax.imageio.ImageIO;
- /**
- *
- * @author eoin
- */
- // I changed the class name to Capture
- public class Capture {
- private static int a = 1;
- /**
- * @param args
- * the command line arguments
- * @throws java.awt.AWTException
- * @throws java.io.IOException
- */
- public static void main(String[] args) throws AWTException, IOException,
- InterruptedException {
- System.out.println(" {__ {__ {__ {__ {___ {__ {__ ");
- System.out.println("{_ {__ {__ {__ {__ {__ {__ {_ {__");
- System.out.println("{_ {__ {__ {__{__ {__ {__ {_ {__");
- System.out.println(" {__{__ {__ {__{__ {__ {__ {_ {__");
- System.out.println(" {__ {__{__ {__ {___{___ {_ {__");
- System.out.println(" {___ ");
- System.out.println("GNU general public");
- // System.out.println("Start screen recording?: Y/N");
- // Scanner scan = new Scanner(System.in);
- // int framerate = scan.nextInt();
- // framerate = a;
- // TODO code application logic here
- while (a < 15) {
- Thread.sleep(1000L);
- // do something
- // pause to avoid churning
- /*
- * Hammer the JVM with junk
- */
- a++;
- System.out.println("FRAME" + a);
- /* File location is C:\Users\computerName\screenshot.png */
- // I made changes here
- File saveImage = new File(System.getProperty("user.home")
- + "/Desktop" + "\\screencast" + a + ".png");
- /* Define how much area you want to capture */
- Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit()
- .getScreenSize());
- /* Capture image */
- BufferedImage imageCapture = new Robot()
- .createScreenCapture(rectangle);
- /* Write BufferedImage to file */
- ImageIO.write(imageCapture, "png", saveImage);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment