Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ScreenGrabber.java
1 package ij.plugin;
2 import ij.*;
3 import java.awt.*;
4 
6 public class ScreenGrabber implements PlugIn {
7 
8  public void run(String arg) {
9  if (!IJ.isJava2()) {
10  IJ.showMessage("Screen Grabber", "Java 1.3 or later required");
11  return;
12  }
13  try {
14  Robot robot = new Robot();
15  Toolkit toolkit = Toolkit.getDefaultToolkit();
16  Dimension dimension = toolkit.getScreenSize();
17  Rectangle r = new Rectangle(dimension);
18  Image img = robot.createScreenCapture(r);
19  if (img!=null)
20  new ImagePlus("Screen", img).show();
21  } catch(Exception e) {
22  }
23  }
24 
25 }
26