Java-Paint-Komponente in bitmap

Muss ich ziehen, den Inhalt einer Komponente und alle Unterkomponenten in einem bitmap.
Der folgende code funktioniert perfekt, wenn ich zeichnen möchte, wird die ganze Komponente :

public void printComponent(Component c, String format, String filename) throws IOException {
//Create a renderable image with the same width and height as the component
BufferedImage image = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);

    //Render the component and all its sub components
    c.paintAll(image.getGraphics());

    //Render the component and ignoring its sub components
    c.paint(image.getGraphics());
//Save the image out to file
ImageIO.write(image, format, new File(filename));

}

aber ich habe nicht einen Weg finden, der Zeichnung nur eine region dieser Komponente.
Irgendeine Idee ?

InformationsquelleAutor Arutha | 2010-11-22
Schreibe einen Kommentar