Printing from a applet toolbar the image displayed in the applet

Hi ,

I have a JApplet which displays a tiff image. The applet uses JAI API and Java 2D for printing. I can zoom in . zoom out , invert the image and I am printing the displayed image also .

In the action handler class for the print button , I have made an inner class implementing printable and executing the print function.

I am doing printing via a separate thread as i don't want my action handler class to keep waiting till the image gets printed . The user should be able to manipulate the image after it has clicked on the "ok" of the print dialog, while the image is being printed. This is the reason for printing the image in a separate thread

and the actual printing process is a synchronized method called by the run method of the thread .

If I click on print button twice , one after another , the second image gets printed only after I get a response from the printer that image has been printed as expected (as the print method is synchronized ).

In the action handler class of print , I do not call join on the thread as I do not want it to wait for printing to get over ( printing of a tiff image actually takes a long time ? )

Is there anyway to make the threads independent of the main applet . Like after firing the print command , if I close the applet and I haven't got a confirmation from the printer, I get a blank page or nothing but i get a response message from printer that printing is done .

Is it essential for a thread to wait till the printer sends a response that printing is over ?

Similarly , If after firing the printing command and without waiting for the confirmation from the printer , I refresh the applet , proper printing does not occur but I get a message from the printer that printing is done .

If i use synchronized method for printing and wait till the printer response from the printer comes without closing or refreshing the applet , printing occurs fine .

Can anyone please tell me what is actually happening and is there a better way to print and that printing occurs after the print command has been fired irrespective of the applet ?

Regards , Navneet

[2201 byte] By [KangN] at [2007-9-26 7:17:58]
# 1
I am working on printing an image from applet,when I print,no errors occur,but the image can not come out,willyou please send me some code? thank you in advance!
wanderzhou at 2007-7-1 17:06:14 > top of Java-index,Security,Cryptography...
# 2
and to me? :)
denis_pitzalis at 2007-7-1 17:06:15 > top of Java-index,Security,Cryptography...
# 3
Hey can you send me the code for the same. I know its been a long while, but I am new to JAI and need the same stuff u coded. u can mail it to me on s.rishi@gmail.comThanks in advance.
Shah_Rishi at 2007-7-1 17:06:15 > top of Java-index,Security,Cryptography...