screen Shot JComponent - Java Swing

Java examples for Swing:JComponent

Description

screen Shot JComponent

Demo Code


//package com.java2s;

import java.awt.image.BufferedImage;

import javax.swing.JComponent;

public class Main {
    public static BufferedImage screenShot(JComponent c, int w, int h) {
        BufferedImage b = new BufferedImage(w, h,
                BufferedImage.TYPE_INT_ARGB);
        c.paint(b.createGraphics());/*w w  w .j a  v  a 2  s .  c om*/
        return b;
    }
}

Related Tutorials