• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using ProgressBar

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic