First,
you should double-buffer your drawing. That is, do all of your drawing into an Image object and then paint that Image.
Second, get the JPEG Encoder from Obrador:
http://www.obrador.com/essentialjpeg/jpeg.htm Third, you can use something like the following method to write the Image as a JPEG to an OutputStream:
Of course, getting permission to create a file from an applet is a whole other can of worms....
