• Post Reply Bookmark Topic Watch Topic
  • New Topic

modal jdialog progressbar  RSS feed

 
c moses
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all, I am having an issue with a modal jdialog progress bar. I currently have a main frame that launches a progressbar, however, processing is taking place in the main frame that should determine when the progress bar is finished. Originally the progressbar was a jframe but in the desire to keep user's from mucking about it was changed to a modal jdialog however, since changing it to a modal jdialog all of the actions in the main frame that should take place to update the progress bar don't happen until the jdialog is closed or cancelled.

I assume this has to do with the fact that the jdialog is modal but I'm not quite sure how to work around that (should the processing take place in the jdialog then rather then the main window...?).

thanks!
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are blocking the Swing event thread with your modal dialog. You need to start one thread to do your work, one thread to display the dialog (remember, it will block that thread) and let the Swing event thread run free so it can do the updating of your progress bar.
 
c moses
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks much - I assume that will still maintain the purpose of the dialog being modal, e.g., locking users out of the main frame until dialog is closed? - I'll give it a try!
 
c moses
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well I've wrapped my jdialog in a seperate thread and have the meat of my processing running in a different thread, thus leaving the event dispatching thread free. However, in the "meat processing" thread I call invokeLater to update my jdialog progress bar and I'm getting
exception in event dispatching thread:
NullPointerException

whenever i try to update or setVisible(false) on the jdialog progressbar, I've checked all variables getting passed back and forth and can't find anything null - does anyone have any suggestions?

thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!