Here you can find the source of captureScreen(Rectangle rect)
static public BufferedImage captureScreen(Rectangle rect)
//package com.java2s; /******************************************************************************* * Copyright 2011 sikuli.org// ww w. j a v a 2s . co m * Released under the MIT license. * * Contributors: * Tom Yeh - initial API and implementation ******************************************************************************/ import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Robot; import java.awt.image.BufferedImage; public class Main { static public BufferedImage captureScreen(Rectangle rect) { try { return (new Robot()).createScreenCapture(rect); } catch (AWTException e) { } return null; } }