Non-modal progress dialog does not get chance to be displayed fully before
the comencement of the heavy processing that it should be displaying the
OK, it's back to basics for a moment I'm affriad.
I'm having a little trouble with a dialog class I've created, being that
it never displays its contents.
My class extends javax.swing.JDialog and is created and shown prior to some
processing intensive stuff (file loading incidentally), during which I wish
the contents of the dialog to be updated.
The dialog window is painted to screen but unfortunately its contents (a
JTextArea and a JProgressBar) do not get chance to be displayed if the dialog
is set up to NOT be MODAL.
If it IS set to be MODAL then the contents display fine, but of course, the
processing that is to be carried out along side it is paused until the dialog
Now understand that the dialog needs time to set up, and update, its display
before passing back control to other processes and so I have tried littering
the appropriate code with several strategically placed Thread.yield()'s and
even Thread.sleep()'s...but to no avail.
I am clearly missing some important code which I wondered if any kind soul
could point out to me.
please email any suggestions direct to me instead of/as well as posting to
Re: Modal dialogs
You need to run your heavy processing in a seperate thread and update the
progress of processing in your dialog from that thread. Look for the
SwingWorker class below on sun's site to do what you want.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center