This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JProgressBar not resetting to 0 or repainting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JProgressBar not resetting to 0 or repainting" Watch "JProgressBar not resetting to 0 or repainting" New topic
Author

JProgressBar not resetting to 0 or repainting

Shaun Seah
Greenhorn

Joined: Mar 15, 2011
Posts: 3
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

Joined: May 03, 2008
Posts: 4522
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JProgressBar not resetting to 0 or repainting
 
Similar Threads
Problems using JTabbedPane In a GUI application
JTable problem
JTable ........
How to change Jtable Total Rows in runtime ?
JTable