Question: Help with Java! Can someone check my code What I am trying to accomplish is the user inputs their workstation number and what the issue

Help with Java! Can someone check my code What I am trying to accomplish is the user inputs their workstation number and what the issue is. Then the code will execute a screen capture. This is what I have so far

import java.awt.*;

import java.awt.image.RenderedImage;

import java.io.File;

import java.util.Scanner;

import javax.imageio.ImageIO;

public class takeScreenCapture { public static void main() throws Exception { Scanner input = new Scanner(System.in);

System.out.print("Hello Enter Your Issue and Workstation Number: ");

String wsNumber = input.next();

Robot robot = new Robot();

// This should save the screen capture in the appropriate path//

String path = "C:\\Users\\Public\\Pictures\\Screenshots\\Workstation" + wsNumber + ".jpg"; /* Used to get ScreenSize and capture image */

Rectangle capture;

capture = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());

BufferedImage Image = (BufferedImage) robot.createScreenCapture(capture); ImageIO.write((RenderedImage) Image, "jpg", new File(path));

System.out.println("Screenshot saved");

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!