Re: Drawing a screenshot of a component



> For a drag and drop operation, on mousePressed on a JButton, I want to
> draw a "screenshot" of the JButton.
>
> Anybody knows how?

As Andrew mentioned, you can use Robot.

Another way is to create BufferedImage or (better) VolatileImage
and paint component into image's Graphics.
I used this technic to paint dock preview.
See docking demo at http://jgui.imagero.com/classes/gtest.jnlp

--
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities


.