The list of methods to do Screenshot are organized into topic(s).
BufferedImage
acquireScreenshot(Component component) Makes a hardcopy image from the given component.
Rectangle rect = component.getBounds();
Insets insets = null;
if (component instanceof Window) {
insets = ((Window) component).getInsets();
rect.width -= insets.left + insets.right;
rect.height -= insets.top + insets.bottom;
BufferedImage image = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_RGB);
...
BufferedImage
capture() capture
try {
Robot robot = new Robot();
Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage bufferedImage = robot.createScreenCapture(area);
BufferedImage scaledImage = new BufferedImage(bufferedImage.getWidth() / 20,
bufferedImage.getHeight() / 20, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2D = scaledImage.createGraphics();
graphics2D.drawImage(bufferedImage, 0, 0, scaledImage.getWidth(), scaledImage.getHeight(), null);
...
void
capture(final String fileName, final Rectangle rect) capture current window.
final String name = fileName.toLowerCase().endsWith(".png") ? fileName : fileName.concat(".png");
try {
final BufferedImage img = new Robot().createScreenCapture(rect);
ImageIO.write(img, "png", new File(name));
} catch (final IOException | AWTException e) {
e.printStackTrace();
BufferedImage
captureAsScreenshot(final Frame frame) Captures screenshot of component nd returns as BufferedImage.
BufferedImage bi = null;
try {
Robot robot = new Robot();
Rectangle bounds = getInternalRectangle(frame);
bi = robot.createScreenCapture(bounds);
} catch (AWTException e) {
e.printStackTrace();
return bi;
BufferedImage
captureCurrentMonitor() capture Current Monitor
Point cursor = MouseInfo.getPointerInfo().getLocation();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screens = ge.getScreenDevices();
Robot robot = null;
Rectangle bounds = null;
for (GraphicsDevice screen : screens) {
bounds = screen.getDefaultConfiguration().getBounds();
if (bounds.contains(cursor)) {
...
List
captureEachMonitor()
capture Each Monitor
List<BufferedImage> result = new ArrayList<BufferedImage>();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screens = ge.getScreenDevices();
for (GraphicsDevice screen : screens) {
try {
Robot robot = new Robot(screen);
Rectangle screenBounds = screen.getDefaultConfiguration().getBounds();
screenBounds.x = 0;
...
BufferedImage
captureMainMonitor() capture Main Monitor
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
try {
return new Robot().createScreenCapture(screenRect);
} catch (AWTException e) {
e.printStackTrace();
return null;