wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Auto close of MessageDialog?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Auto close of MessageDialog?? " Watch "Auto close of MessageDialog?? " New topic
Author

Auto close of MessageDialog??

Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
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
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
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 ]
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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...



-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Auto close of MessageDialog??
 
Similar Threads
MessageDialog without a button
Help with JDialog Close Operation
Query on DialogBox ??
pop ups
Close a pop-window after submit is complete?