Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using ProgressBar

 
Mike Gerald
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am developing a new converter application using Swing,I need to use a progressbar to show the progress of converted files.How do i do it dynamically,ie as soon as a file gets converted the progressbar should update.Please Help
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use the setMaximum() method to set the JProgressBar's maximum value to the number of files you are converting and every time you convert a file you call setValue() on it with the count of files converted to move the progress bar. Be aware that you need to be converting your files in a seperate thread from the Swing event thread (i.e. the one that calls your gui listener methods). That same thread is responsable for updating the GUI.
 
Always! Wait. Never. Shut up. Look at this tiny ad.
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!