how can you record your screen using java

Solutions on MaxInterview for how can you record your screen using java by the best coders in the world

showing results for - "how can you record your screen using java"
Cheryl
22 Mar 2020
1import java.awt.Dimension;
2import java.awt.Rectangle;
3import java.awt.Robot;
4import java.awt.Toolkit;
5import java.awt.image.BufferedImage;
6import java.io.File;
7import javax.imageio.ImageIO;
8
9public class ScreenCapture {
10public static void main(String args[])
11{
12	try
13	{		
14     Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
15     Robot robot = new Robot();
16     BufferedImage img = robot.createScreenCapture(new Rectangle(size));
17     File save_path=new File("screen.jpg");
18     ImageIO.write(img, "JPG", save_path);
19	}
20	catch(Exception e)
21	{
22		
23	}
24}
25}
26