Another quick tutorial on capturing your entire screen with java actually sometimes java makes me mad because sometimes i have to import loads of namespaces than c# or vb.net anyways , as usual to do something in system we import IO thingy yes we are using it here .
just compile the program and run then you will see the image in the app root , the image looks bit weird though .
i am sleeping right know , Good Night.
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.*;
class Snap
{
public static void main(String args[]) throws Exception
{
Robot awt_robot = new Robot();
BufferedImage Entire_Screen = awt_robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(Entire_Screen, "PNG", new File("Entire_Screen.png"));
}
}
The rectangle thing that's something very much new for me , you can use it get size or set size for a image and many more things and what else ? eh the toolkit is has a very important part in this (AH all the parts are very important) and then you name the image and name the extension finally name the whole name(name+extension)just compile the program and run then you will see the image in the app root , the image looks bit weird though .
i am sleeping right know , Good Night.
2 comments
Sekolah Blogger Indonesia
ReplySekolah Adsense
Sekolah Wordpress
Sekolah Blogger
Sekolah Hosting
Sekolah SEO
Forum Anime Indonesia 121212121
Great Article
ReplyOnline Java Training
Java Training Institutes in Chennai
Java Training in Chennai
Post a Comment
Note: Only a member of this blog may post a comment.