public static void main(String[] args) throws IOException {
DesktopScreenRegion smallRegion = new DesktopScreenRegion(500,500,400,200);
canvas.addBox(smallRegion).display(1);
BufferedImage capturedImage = smallRegion.capture();
ImageIO.write(capturedImage, "png", new File("SavedCaptuedImage.png"));
}
}