Originally posted by Rob Prime:
Read JProgressBar Doesn't Update.
The original poster should definitely read that page, but there's more than that going on here.
The code calls the progressBar() method, then presumably it generates the key pair. The thing is, the progressBar() method is implemented to (attempt to) slowly notch the progress bar forward between calls to Thread.sleep(). So first the progressBar() method imposses a multisecond delay, and not until that delay is over does the code start to generate the key pair.
This is, in short, crazy. At the very least the loop calling Thead.sleep() should be running on a different
thread from the code generating the key pair. (And neither of those threads should be the Event Dispatch thread.) That would still be kind of crazy, but less so.