Advertisement
Guest User

Screen recording

a guest
Jun 30th, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.19 KB | None | 0 0
  1.  
  2. import java.awt.AWTException;
  3. import java.awt.Rectangle;
  4. import java.awt.Robot;
  5. import java.awt.Toolkit;
  6. import java.awt.image.BufferedImage;
  7. import java.io.File;
  8. import java.io.IOException;
  9. import java.util.Scanner;
  10. import javax.imageio.ImageIO;
  11.  
  12.  
  13.  
  14. /**
  15.  *
  16.  * @author eoin
  17.  */
  18. public class JavaApplication4 {
  19.     private static int a;
  20.  
  21.     /**
  22.      * @param args the command line arguments
  23.      * @throws java.awt.AWTException
  24.      * @throws java.io.IOException
  25.      */
  26.     public static void main(String[] args) throws AWTException, IOException, InterruptedException {
  27.        
  28.         System.out.println("  {__   {__  {__   {__    {___ {__ {__ ");
  29.         System.out.println("{_  {__ {__  {__ {__  {__  {__  {_  {__");
  30.         System.out.println("{_  {__ {__  {__{__   {__  {__  {_  {__");
  31.         System.out.println(" {__{__ {__  {__{__   {__  {__  {_  {__");
  32.         System.out.println("    {__   {__{__  {__ {___{___  {_  {__");
  33.         System.out.println("    {___  ");
  34.         System.out.println("GNU general public");
  35.        
  36.        
  37.         //System.out.println("Start screen recording?: Y/N");
  38.         //Scanner scan = new Scanner(System.in);
  39.         //int framerate = scan.nextInt();
  40.        
  41.         //framerate = a;
  42.    
  43.         // TODO code application logic here
  44.        
  45.         while(true) {
  46.            Thread.sleep(1000L)
  47.            
  48.             // do something
  49.             // pause to avoid churning
  50.        
  51.  
  52.        
  53.         /*
  54.          * Hammer the JVM with junk
  55.          */
  56.        
  57.             a++;
  58.             System.out.println("FRAME" + a);
  59.         /* File location is C:\Users\computerName\screenshot.png */
  60.             File saveImage = new File(System.getProperty("user.home") + "/Desktop" + a +"\\screencast.png");
  61.         /* Define how much area you want to capture */
  62.             Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
  63.         /* Capture image */
  64.             BufferedImage imageCapture = new Robot().createScreenCapture(rectangle);
  65.         /* Write BufferedImage to file */
  66.             ImageIO.write(imageCapture, "png", saveImage);
  67.            
  68.            
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement