Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JProgressBar issue  RSS feed

 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i'm sure validateKeyGenParameters() is return true during press button ok,okPressed().
can not see the steppping progress bar

Sincerely,

Willie
 
Rob Spoor
Sheriff
Posts: 20904
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read JProgressBar Doesn't Update.
 
Brian Cole
Author
Ranch Hand
Posts: 937
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!