I know how to get a BufferedImage from JComponent, but how to get a BufferedImage from a Component in java ? The emphasis here is an object of the "Component" type rather than JComponent.
I tried the following method, but it return an all black image, what's wrong with it ?
public static BufferedImage Get_Component_Image(Component myComponent,Rectangle region) throws IOException
{
BufferedImage img = new BufferedImage(myComponent.getWidth(), myComponent.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
myComponent.paint(g);
g.dispose();
return img;
}