File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JProgressBar not resetting to 0 or repainting

 
Shaun Seah
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have a JSwing frame that queries a database and spits out results in a JTable.
I have included a JProgressBar to monitor as each record is retrieved after a button is pressed.

So far the code works when i click on my button the first time, however subsequent button clicks the JProgressBar does not reset to 0.

heres some code:



Can anyone shed a light why the second time i click on retrive button the progressBar doest not reset to 0 and stays at 100%?

tks!
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you're scheduling the long running task on the EDT instead of in a background Thread.

Go through the tutorial on Concurrency in Swing linked from the tutorial on How to Use Progress Bars, which again is linked from the API for JProgressBar.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic