Hello Paco,
you can render the contents of a component into an image
by doing something like this:
Component comp;
comp = ... // create your component, set it's size, etc
BufferedImage bi = new BufferedImage(comp.getWidth(),
comp.getHeight(),
BufferedImage.TYPE_INT_RGB);
Graphics g = bi.getGraphics();
comp.paint(g);
Now image 'bi' contains the data you needed.
Thank you,
Dmitri
On Mon, Mar 18, 2002 at 12:22:0p -0700, Paco Belloso wrote:
> Health!
>
> I need to dump the frame contents (fields, etc) into an image, like a screenshot,
>but with two handicaps:
>
> 1. The program runs on a machine without display (offscreen rendering).
> 2. The main component I need to render is awt based.
>
> I can't find a method to get an Image from a Graphics of a component just drawn.
>
> I've tried to find a GraphicsDevice with TYPE_IMAGE_BUFFER but it only ennumerates
>the main display on Linux and Windows.
>
> I've tried also with PJA offscreen rendering package but doesnt works with awt
>components.
>
> �Is it possible?. Must I have a display and use Robot.createScreenCapture() on a
>visible frame to create the image?.
>
> Thanks in advance.
>
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".