Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Busy popup dialog box in Swing  RSS feed

 
Ray Kumar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

How to display a busy popup dialog box in SWING app when something is being done(in process like database access or processing) and nothing else is accessible ?

Thanks in advance.
 
Shashank Agarwal
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Construct a JDialog object which would have no buttons and just a text saying that the program is busy. Keep it modal (so that people cannot ignore it!). Just before the processing begins, use the show() function to show this Dialog, and as soon as its over, use the hide() function to, well, hide the dialog.

Simple, huh?
 
Ray Kumar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

In swing, if someprocess is executing, the entire screen/app under that thread blocks and greyed and blank util the process is finished, so user cann't see our dialog popup til end of the process. We can create a separate thread for processing so that main thread does not get blocked , but I am looking for any generic & simple way of doing this. Any other ideas ?


Thanks !!!
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Multithreading is practically required when writing a responsive gui. Any time you occupy the Swing event thread with processing tasks you are preventing the GUI from being updated and frustrating your users. Using threads is as "simple and generic" as doing two things at once gets. Check out the
How To Use Threads section of the Java Swing Tutorial. Your users will be glad you did.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!