JProgressBar Flickering!  
Author Message
Ad





PostPosted: 2005-5-22 11:10:00 Top

java-programmer, JProgressBar Flickering! Hi everyone! I just have a little question here!

I have a Swing GUI in which I put a JProgressBar.
I also have a static class where I put a static variable JProgressBar.

In my main program, because the static methods are time consuming, I
start a new thread, where I initialize the static JProgressBar with the
one in main gui.

So I'm able to update the text, value, etc in the GUI without locking
my main program.

The problem is:

I put progression report [ progressBar.setValue(int) ] in my loops to
see the change. It works perfectly BUT!!!

Every time it sets a new value, the progress bar show a lot of
flickering! I enabled double buffering on it, but no effect!

How can I remove this bad effect??? If some knows please tell me quick
:)



Thanks,
Ad
 
Tjerk Wolterink





PostPosted: 2005-5-23 5:50:00 Top

java-programmer >> JProgressBar Flickering! Ad wrote:
> Hi everyone! I just have a little question here!
>
> I have a Swing GUI in which I put a JProgressBar.
> I also have a static class where I put a static variable JProgressBar.
>
> In my main program, because the static methods are time consuming, I
> start a new thread, where I initialize the static JProgressBar with the
> one in main gui.
>
> So I'm able to update the text, value, etc in the GUI without locking
> my main program.
>
> The problem is:
>
> I put progression report [ progressBar.setValue(int) ] in my loops to
> see the change. It works perfectly BUT!!!
>
> Every time it sets a new value, the progress bar show a lot of
> flickering! I enabled double buffering on it, but no effect!
>
> How can I remove this bad effect??? If some knows please tell me quick
> :)
>
>
>
> Thanks,
> Ad

You should update the progressbar in the event-dispatching thread.
See http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
for more info.
 
Thomas Weidenfeller





PostPosted: 2005-5-23 15:18:00 Top

java-programmer >> JProgressBar Flickering! Ad wrote:
> Hi everyone! I just have a little question here!
[...]
> I put progression report [ progressBar.setValue(int) ] in my loops to
> see the change. It works perfectly BUT!!!
>
> Every time it sets a new value, the progress bar show a lot of
> flickering! I enabled double buffering on it, but no effect!

Please use less exclamation marks and show us more code.
--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq