JavaSpace
Would you like to react to this message? Create an account in a few clicks or log in to continue.

JavaSpace

JavaSpace is a forum were people can help others learn java. Also a place for tutorials. We do everything java!
 
HomePortalSearchLatest imagesRegisterLog in

 

 [TuT- Source Code] Screen Capture Program

Go down 
AuthorMessage
JavaClaDZ
Admin
JavaClaDZ


Posts : 18
Join date : 2008-02-23
Age : 33

[TuT- Source Code] Screen Capture Program Empty
PostSubject: [TuT- Source Code] Screen Capture Program   [TuT- Source Code] Screen Capture Program Icon_minitimeSun Feb 24, 2008 1:16 am

This Program captures your working window as jpeg image and stores it in the same directory as where your java class after compiling by javac.
Note once you hit void main args it works after 5 sec check that programs folder

Bellow is source code for a Screen Capture Progran in Java.
Code:

      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;

/**
 * Takes a picture of the screen of your computer
 */

      public class screen2image
      { 
          public static void main(String[] args) throws Exception
     
      {

          Robot robot = new Robot();
          BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
          ImageIO.write(screenShot, "JPG", new File("YourscreenShot!.jpg"));

      }

      }
 
Back to top Go down
https://javaspace.board-directory.net
 
[TuT- Source Code] Screen Capture Program
Back to top 
Page 1 of 1
 Similar topics
-
» [TuT Source code] - if else statements
» [Tut-Source code]-very easy swing into{Hello from JavaSpace

Permissions in this forum:You cannot reply to topics in this forum
JavaSpace :: JavaTutorial Index :: Tutorials-
Jump to: