Hi, I'm developing an applet, which should get an array of image paths on local computer, transform them and then save to the local computer. My first idea was to write a simple for cycle. But it seems to be impossible due to the privileged action interface, which runs as separate thread - the main thread continues the for without waiting to the privileged thread to end. I was able to write code which sleeps the main thread in a while loop to wait to the privileged thread to end. But this solution totally freezes the main applet window. The freeze remains until ALL images are processed, even if I wrote it so it wakes up from sleep before each image. And this is terrible, because I also want to have a progressbar showing transformation progress.

So I ask you how can I let the main thread wait for privileged thread unfreezed and continually getting progress info from the privileged thread ;)

I tried to substitute the sleep with a wait. It didn't freeze the main window, but it threw IllegalMonitorState exception after processing the first image.

Thanx for your opinions :)