Removed try catch and set to throw the exception

This commit is contained in:
Sameera 2016-10-18 22:49:09 +05:30
parent 8fb51bdfd6
commit 3e31921e49
1 changed files with 6 additions and 10 deletions

View File

@ -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() {