Hi Ananth,

Quite apart from Robot, you can save the contents of any
component using the JPEG encoder. Here's one way to do it:

  http://www.javaworld.com/jw-01-1999/jw-01-media.html#sidebar1

Scroll down to the question "I want to take snapshots of Java
components. How do I do this?" The saveComponentAsJPEG()
method is what you want. This method also demonstrates
one way of converting Images to BufferedImages. Note that
this technique only saves the inside of components; it won't, for
example, save the window decorations of a frame window.

FYI, there are some problems with using 2D without creating
any windows, as you wish to do server-side. I'm not an
expert in this, so I'm afraid I can't help you work around this
issue. Other people on the list have discussed it, however.

Jonathan
Java 2D Graphics : http://www.oreilly.com/catalog/java2d/
Bite-Size Java : http://java.oreilly.com/news/knudsen/
LEGO MINDSTORMS Robots : http://www.oreilly.com/catalog/lmstorms/

At 07:27 AM 9/3/99 -0700, Ananth wrote:
>Thank you very much for your response. I got a couple of more questions
regarding this.
>If someone could give me pointers on them, I would highly appreciate it.
>
>1. java.awt.Robot's screenCapture method returns a java.awt.Image, whereas
>   JPegEncoders's encode method takes in java.awt.image.BufferedImage!
>   Is there any workaround for this?
>2. What I'm trying to accomplish is to create an image on Server side.
>   But I'm trying to use Swing components to create a jazzy Panel and then
trying to save that as a gif/jpeg.
>   So I would not really even want to display the Panel on the screen
(means I would not be using setVisible(true) on the panel!).
>   Any pointers???
>
>--Ananth.

===========================================================================
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".

Reply via email to