I created a custom modal dialog class that will pop-up, run some Runnable task, and then go away once the task is complete. It's a very basic window containing a single JLabel that displays some informational message to the user, like "Retrieving data...". Here is the code:
To use it, I am launching a new
thread, something like this:
The problem is this: The
first time I launch a new ModalDialog, it looks perfect - the window appears with the appropriate message. However, in
subsequent uses, the JLabel does not appear so the user just sees a blank modal window. The only difference I can see is that the first launch occurs within the constuctor of my app whereas the subsequent launches originate through the event thread (e.g. user clicked a button). However, since in both cases, I run the ModalDialog in a new thread, it doesn't seem like that should matter.
I have tried many things such as calling repaint(), validate(), launching new threads, etc, etc.
Does anyone have any suggestions?