This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes progress bar and threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "progress bar and threads" Watch "progress bar and threads" New topic

progress bar and threads

tomo black

Joined: Mar 01, 2004
Posts: 11
hi, i have a progress bar that shows the completion of a task but it's not running like it should. the bar only moves when the task is completed, not during the task. do i need to implement the bar as a seperate thread or have i messed up in the coding
thanks in advance
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Yes, you need to use another thread to do the processing, and update the progress bar in the event thread. It sounds like you might be trying to update the progress bar inside the thread you are using to do the processing. Here is a link to the section on progress bars in the Swing tutorial.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: progress bar and threads
It's not a secret anymore!