Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I make JProgressBar update itself during execution?  RSS feed

 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I have my class that extends SwingWorker. My class is reused for many db access methods.
My SwingWorker has JProgressBar that should be updated as execution progresses.
The problem is that every method I run with SwingWorker needs to be modified in order to update progress bar.
This means that I need to call progressBar.setProgress(myValue) several times during method execution.

Can I have JProgressBar that updates itself depending on how much job(method) is performed already?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup. As long as you do it on the EDT. If you are using SwingWorker, the updating should happen from inside the publish()
You might also want to go over https://www.coderanch.com/how-to/java/JProgressBarDoesntUpdate
 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply!

May you also see my similar question here
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!