Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Progress Bar refreshing!

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JProgressBar on my status pane.
As I progress I need to set the value on the Progress Bar so I call this method...
public void setValue(int value){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
m_progressBar.setValue(value);
m_progressBar.updateUI();
}
});
}
This should repaint the ProgressBar with the value as the rest of the task is in progress, but it does not refresh itself until the whole task is complete.

Please help me out in doing the needfull to refresh the ProgressBar as and when the setValue() method is called.

Thanks n Regards
Jenith
 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should have posted this message in the Swing/awt forum. Bartender, can you do that?
The updateUI method code is useless here. It is used to change properties of the look-and-feel, which is here not the case. So you can remove it.
Swing uses a modified Model-View-Controller (MVC pattern), which a Model-UI pattern. When a call to setValue() in JProgressBar is made, this call is delegated to the model which is embedded in the JProgressBar. The model then notifies the view that it should repaint. This should be automatic. So I don't quite get the point using invokeLater.
Check


[This message has been edited by Wilfried LAURENT (edited October 17, 2001).]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure, I will move this to Swing.
 
Ranch Hand
Posts: 71
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic