I have a UI built inside a JFrame. One of the buttons starts a long running call (still within the same java process), and during it's execution, the UI is frozen.
I figured, to make it clear that things are still running, I can display a progress bar, perhaps in a popup, so that the user can be kept up-to-date as to what the program is doing.
So I'm creating a new JDialog, adding a JProgressBar to it, and updating it as things happen. The problem is that that dialog's content isn't getting updated. Changes I make to it's title show up immediately, and anything I output to the console, but nothing in the UI itself.
Is there a command I can issue to force a repaint?
Here's the core of this section:
killWindow = new JDialog();
killWindow.setUndecorated(true);
killWindow.setTitle("stopping tests - 0 of " + numActive);
killProgress = new JProgressBar(0, numActive);
killWindow.add(killProgress);
killProgress.setStringPainted(true);
killWindow.pack();
killWindow.setLocationRelativeTo(frame);
killWindow.setVisible(true);
Then, as we progress...:
killProgress.setValue(++killedTests); // not seen!
killProgress.setString("Killing test on " + nickname()); // not seen!
log("Killed another test, " + killedTests + " so far"); // visible in real time
killWindow.setTitle("stopping tests - " + killedTests +
" of " + killProgress.getMaximum()); // visible in real time
What am I missing? I tried googling and searching here on SO, and haven't really seen anything obvious?