Image from AWTComponent

hi all,

how can i make an Image from an AWTComponent with his childs? I have tryed the class Robot but this is not the right way because the Component is bigger as the Frame.

thank you in advance

bienator

Not sure it would work, but you might try…

BufferedImage image = new BufferedImage(blah, blah,blah)

component.paint(image.getGraphics());

Kev

that is what i tryed

it works, but i get only the Graphics(gray background) but not the childs(Buttons…) :frowning:

bienator

Have you tried component.paintAll(g) ?

Kev

wait…

the same output
just the Graphics without childs

bienator

stupid errrrr

I used Labels, Buttons and other stuff which all extends Component. Now I use only JComponents and it works great :slight_smile:

thank you for the help kev
.paint
.paintAll
works great

bienator