How To Capture Entire Screen In Java

capture jn
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 anyways , as usual to do something in system we import IO thingy yes we are using it here .

import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
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.