Removed try catch and set to throw the exception
This commit is contained in:
parent
8fb51bdfd6
commit
3e31921e49
|
@ -20,16 +20,12 @@ public class Screenshot {
|
|||
this.timeToWait = timeToWait;
|
||||
}
|
||||
|
||||
public void getScreenshot() {
|
||||
try {
|
||||
Thread.sleep(timeToWait);
|
||||
Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
Robot robot = new Robot();
|
||||
BufferedImage img = robot.createScreenCapture(rectangle);
|
||||
ImageIO.write(img, fileType, setupFileNamePath());
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Error occurred while getting the Print Screen.");
|
||||
}
|
||||
public void getScreenshot() throws Exception {
|
||||
Thread.sleep(timeToWait);
|
||||
Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
Robot robot = new Robot();
|
||||
BufferedImage img = robot.createScreenCapture(rectangle);
|
||||
ImageIO.write(img, fileType, setupFileNamePath());
|
||||
}
|
||||
|
||||
private File setupFileNamePath() {
|
||||
|
|
Loading…
Reference in New Issue