This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Repaint help??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Repaint help???" Watch "Repaint help???" New topic

Repaint help???

Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
Can anyone tell me how to repaint a component directly, rather than just entering it into the repaint queue.
I want to provide a progress bar for a lengthy operation, but my progress bar doesn't get repainted until the entire operation is complete.
I've tried:
1) Calling the traditional repaint() method on the progress bar and then calling Thread.sleep(10000).
2) calling the components paint() method directly.
Neither seemed to have worked for me. Are there any other options?

Fun programming etcetera!
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Swing is picky about threads and gui updates. Here's apointer into the tutorial page on dealing with progress bars.
I agree. Here's the link:
subject: Repaint help???
It's not a secret anymore!