Description
can we create a java program to capture the monitor screen
Explanation & Answer
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import java.io.*;
public class ScreenGrab {
public static void main(String[] arg) throws Exception {
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(
new Rectangle(0, 0, (int)screenDim.getWidth(),
(int)screenDim.getHeight()));
File fi=new File("ScreenGrab.jpg");
ImageIO.write(image,"jpg",fi);
Toolkit.getDefaultToolkit().beep();
}
}
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
The Adventures of Huckleberry Finn
by Mark Twain
Murder on the Orient Express
by Agatha Christie
A Brief History of Humankind Sapiens
by Yuval Noah Harari
Narrative of the Life of Frederick Douglass
by Frederick Douglass
The Russian Hoax
by Gregg Jarrett
The Subtle Art of Not Giving a F*ck
by Mark Manson
Night
by Elie Wiesel
Nervous Conditions
by Tsitsi Dangarembga
Killers of the Flower Moon
by David Grann