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

Using ProgressBar  RSS feed

 
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: 9406
12
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!