PrintDialog save to file , as jpeg?

I am using a printdialog to print a jpanels contents , the printing is fine but i'm a little confused about how to go about changing the save to file section of the print dialog. The dialog saves as a .prn file , since a .prn file isnt particularly useful to the end user i'm trying to save it as a .jpeg or .gif.

setting the PrintRequestAttributeSet aset to aset.add(new Destination(new File("test.jpg").toURI())));

only changes the .prn file to .jpeg in name only.

Would encoding the contents of the jpanel to a jpeg then setting the DocFlavor to jpeg fix the save to file part of the printdialog ?

[628 byte] By [BeyondGoodAndEvila] at [2007-11-26 13:42:26]
# 1
Well passing a jpeg stream to printerdialog or serviceui doesnt effect the output format as expected :( . Anyone have any example code for overloading the save to file function of ServiceUI ? Seems strange this kind of functionality isnt built it, perhaps i'm missing something.
BeyondGoodAndEvila at 2007-7-8 0:00:15 > top of Java-index,Desktop,Core GUI APIs...
# 2
If you want to save a file as a .jpg, then you need to create a BufferedImage and then use the ImageIO routines to save it in one of the supported image formats. Search the forum for my "ScreenImage" sample class.
camickra at 2007-7-8 0:00:15 > top of Java-index,Desktop,Core GUI APIs...
# 3

Thanks for the reply , but i've already written a component ->buffered image->jpeg converter, the part that i'm having trouble with is overwriting the built in printdialog save to file function , i dont know the names of the functions to overload them nor can i find a place where they are listed. I guess i could make my own printdialog gui but thats just way too much work to just alter the save to file code. Guess i'll just use a seperate jmenu item to launch a save to jpeg method with a filechooser. Though I would like to know if its possible to overload the save to file section of the printdialog.

BeyondGoodAndEvila at 2007-7-8 0:00:15 > top of Java-index,Desktop,Core GUI APIs...