The simple answer is don't draw into the JPanel -- draw into one of Java's
image classes (Image, BufferedImage, etc.) and then draw the Image into
the JPanel. Then save the Image as a jpeg in the usual ways...
Olsen Chris wrote:
Hello All --
I have what is probably a simple problem to you all, but is so far
baffling me, a statistics guy doing programming. I am hoping that
someone may have actually done what I am trying to do.
At the end of some serious mathematical calculations (logistic
regression) I generate a graph in a JPanel. My problem is that I might
do this a few hundred times for a given run of the program. What I want
to do is save the contents of _each_ graph as a jpeg rather than do lots
of screen captures.
In preparation for coding I have been learning a bit about IMAGEIO,
etc., but am stumped about one aspect of my anticipated process: how do
I get the contents of a content pane into an image format?
I am assuming that I can't just cast it somehow; I am also assuming
that I cannot simply draw to an image the same way that I draw to the
content pane. (These assumptions may be wrong??)
I did run across a forum where someone said that they had not done it,
but it SHOULD work in practice and then gave a strategy for doing it.
Is there anyone who HAS done this and could offer a general strategy?
I am OK with the coding before and after the panel contents --> image
step. (Strategy much appreciated, sample code that works adored!)
References to the literature are fine also...
Thank you in advance.
-- Chris
Chris Olsen
H.S. Math / Assessment Facilitator
Educational Service Center
346 2nd Ave. SW
Cedar Rapids, IA 52404-2099
===========================================================================
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".