Hi all friends, I want that my first Dialog should close automatically when my next Dialog pop up.My application requirement is i want to show two types of dialog one is when my work is going on "Please wait.." and another is when my work has beeen completed confimation message "Work has been completed".I want that when my work has beeen completed then my "Please wait.." dialog box should close automatically and confimation message dialog box should pop up.I tried with JOptionPane.showMessageDialog() with in loop but couldn't slove my problem.If it is not possible with MessageDialog then Is there any other way to do this.Plz guide me how i can do that. Regards Bikash
what about using a ProgressMonitor with a ProgressBar. You can also find usage info on them here. I had to do something similar just recently and it worked out great. Hope this helps. [ February 21, 2003: Message edited by: Chris Shepherd ]
I don't think it's going to work with JOptionPane, because, to quote from the API :
All dialogs are modal. Each showXxxDialog method blocks the current thread until the user's interaction is complete.
So if you had one thread doing processing and it launched a JOptionPane, all the processing would stop while the JOptionPane was up...
Here's something I threw together to illustrate what you're trying to do... the dialog itself contains the processing thread to show the spinning text, and it listens to the other thread that tells it when the work is done. That thread launches another thread to actually do the work...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.