code: public static void printScreen(int x, int y, int width, int height, String format,File file)
  	  {
  	     try
  	     {
  		  if(robot == null)
  			  robot = new Robot();
  		     
  		  synchronized (robot)
  		  {
  		     Rectangle rect = new Rectangle(x,y,width,height);
  		     
  		     BufferedImage image = robot.createScreenCapture(rect);
  		     ImageIO.write(image, format, file);
  		  }
  	     } 
  	     catch (Exception e)
  	     {
  		  throw new SystemException(Debugger.stackTrace(e));
  		}
  	  }
docs: ---------------------------------------------------------------