List of usage examples for java.awt Component createImage
public Image createImage(int width, int height)
From source file:Main.java
public static BufferedImage createImage(Component comp) { if (comp == null) return null; BufferedImage image = (BufferedImage) comp.createImage(comp.getWidth(), comp.getHeight()); Graphics g = image.createGraphics(); comp.paintAll(g);/* w ww . j a va2 s. c om*/ return image; }
From source file:no.geosoft.cc.io.GifEncoder.java
/** * Write AWT/Swing component to GIF file. * //from ww w . j a va2s . co m * @param image Image to write. * @param file File to erite to. */ public static void writeFile(Component component, File file) throws AWTException, IOException { Image image = component.createImage(component.getWidth(), component.getHeight()); Graphics graphics = image.getGraphics(); component.printAll(graphics); GifEncoder.writeFile(image, file); }