public class ScreenshotTaker extends Object implements ScreenshotTakerIF
Components.| Constructor and Description |
|---|
ScreenshotTaker()
Creates a new
ScreenshotTaker. |
| Modifier and Type | Method and Description |
|---|---|
void |
saveComponentAsPng(Component c,
String imageFilePath)
Takes a screenshot of the given AWT or Swing
Component and saves it as a PNG file. |
void |
saveDesktopAsPng(String imageFilePath)
Takes a screenshot of the desktop and saves it as a PNG file.
|
void |
saveImage(BufferedImage image,
String filePath)
Saves the given image as a PNG file.
|
BufferedImage |
takeDesktopScreenshot()
Takes a screenshot of the desktop.
|
BufferedImage |
takeScreenshotOf(Component c)
Takes a screenshot of the given AWT or Swing
Component. |
public ScreenshotTaker()
ScreenshotTaker.ImageException - if an AWT Robot (the responsible for taking screenshots) cannot be instantiated.public void saveDesktopAsPng(String imageFilePath)
ScreenshotTakerIFsaveDesktopAsPng in interface ScreenshotTakerIFimageFilePath - the path of the file to save the screenshot to.public BufferedImage takeDesktopScreenshot()
ScreenshotTakerIFtakeDesktopScreenshot in interface ScreenshotTakerIFpublic void saveComponentAsPng(@Nonnull Component c, @Nonnull String imageFilePath)
ScreenshotTakerIFComponent and saves it as a PNG file.saveComponentAsPng in interface ScreenshotTakerIFc - the given Component.imageFilePath - the path of the file to save the screenshot to.@Nonnull public BufferedImage takeScreenshotOf(@Nonnull Component c)
ScreenshotTakerIFComponent.takeScreenshotOf in interface ScreenshotTakerIFc - the given Component.Component.public void saveImage(@Nonnull BufferedImage image, @Nonnull String filePath)
ScreenshotTakerIFsaveImage in interface ScreenshotTakerIFimage - the image to save.filePath - the path of the file to save the image to.Copyright © 2014–2019 AssertJ. All rights reserved.