public interface ScreenshotTakerIF
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 . |
void saveDesktopAsPng(String imageFilePath)
imageFilePath
- the path of the file to save the screenshot to.NullPointerException
- if the given file path is null
.IllegalArgumentException
- if the given file path is empty.IllegalArgumentException
- if the given file path does not end with ".png".IllegalArgumentException
- if the given file path belongs to a non-empty directory.IORuntimeException
- if an I/O error prevents the image from being
saved as a file.BufferedImage takeDesktopScreenshot()
SecurityException
- if readDisplayPixels
permission is not granted.void saveComponentAsPng(Component c, String imageFilePath)
Component
and saves it as a PNG file.c
- the given Component
.imageFilePath
- the path of the file to save the screenshot to.NullPointerException
- if the given file path is null
.IllegalArgumentException
- if the given file path is empty.IllegalArgumentException
- if the given file path does not end with ".png".IllegalArgumentException
- if the given file path belongs to a non-empty directory.IORuntimeException
- if an I/O error prevents the image from being
saved as a file.BufferedImage takeScreenshotOf(Component c)
Component
.c
- the given Component
.Component
.SecurityException
- if readDisplayPixels
permission is not granted.void saveImage(BufferedImage image, String filePath)
image
- the image to save.filePath
- the path of the file to save the image to.NullPointerException
- if the given file path is null
.IllegalArgumentException
- if the given file path is empty.IllegalArgumentException
- if the given file path does not end with ".png".IllegalArgumentException
- if the given file path belongs to a non-empty directory.IORuntimeException
- if an I/O error prevents the image from being
saved as a file.Copyright © 2014–2019 AssertJ. All rights reserved.