• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

modal jdialog progressbar

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
You don't like waffles? Well, do you like this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic