Screen Capture program



import java.awt.*;
import java.io.*;
import java.awt.image.*;
import com.sun.image.codec.jpeg.*;
public class ScreenImage
{
public ScreenImage()
{
OutputStream out = null;
try
{
BufferedImage shot = (new

Robot()).createScreenCapture(new Rectangle(0, 0,

800,600));
out = new BufferedOutputStream(new

FileOutputStream("shot.jpg"));
JPEGImageEncoder encoder =

JPEGCodec.createJPEGEncoder(out);
encoder.encode(shot);
}
catch (Exception exc)
{
exc.printStackTrace();
}
finally
{
try
{
if (out != null)
{
out.close();
}
System.exit(0);
}
catch (Throwable t) {}
}
}
public static void main(String[] args)
{
new ScreenImage();
}
}


Responses

0 Respones to "Screen Capture program"

Post a Comment

 

Recent Comments

Popular Posts

Return to top of page Copyright © 2010 | Platinum Theme Converted into Blogger Template by HackTutors