• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Auto close of MessageDialog??

 
Bikash Paul
Ranch Hand
Posts: 342
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 286
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic