So override paint, replace the Graphics with a BufferedImage's Graphics, draw to that, then save that as a file.