| Author |
Refreshing a JProgressBar
|
Eoin Mac Aoidh
Ranch Hand
Joined: May 19, 2005
Posts: 48
|
|
Hi, I am having trouble refreshing the progress bar in my application. Its value is being updated, however the bar does not move... I set up my progress bar: public StatusBar(){ pbar = new JProgressBar(); pbar.setMinimum(MYMINIMUM); pbar.setMaximum(MYMAXIMUM); pbar.setValue(5); //to show that some progresss is underway initially add(pbar); } Then in the main class I set the progressbar up in a pop up window of its own using getStatusBar: public void getStatusBar(){ StatusBar sb = new StatusBar(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(sb); frame.setLocation(300,300); frame.pack(); frame.setVisible(true); } when I want the bar to show progression I call its UpdateBar method: public void updateBar(){ System.out.println("Updating status bar"); pbar.setValue(45); /**The pbar object can be accessed - I can get its value. * and I can set it - the print statement shows its value is being updated, but the actual visual display of the bar dosnt change! **/ while(inc<100){ pbar.setValue(inc); inc = inc + 5; //System.out.println(pbar.getValue()); } } Any ideas why this isnt refreshing? Thanks, Eoin.
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8259
|
|
|
If you do a search of this forum for JProgressBar you'll get 46 hits, including this very interesting discussion.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
 |
|
|
subject: Refreshing a JProgressBar
|
|
|