Re: [Java-gnome-developer] updating GNomeAppBar.progressbar while running a long process.
Brought to you by:
afcowie
From: Ismael J. <ml...@ju...> - 2005-04-19 02:44:27
|
On Mon, 2005-04-18 at 23:24 -0300, Joao Victor wrote: [..] > > I think you can still use a Timer on that. In fact, it seems when you use Swing's JProgressBar you > actually use it with a Timer... so i think that's the common way of doing it, to put it this way. > > I just wrote a tutorial about how to do it, hope it helps (if not, let me know): > > http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/UsingProgressBars > > (yup, we still are going to fix the CustomEvents... but anyway i think you should use a > progressbar with a Timer, like that tutorial) [..] It's quite late here, so I might have missed something, but to me that code is not totally correct. You are accessing the field fraction from two different threads, but you do not take any measures to ensure that both threads see the correct value. I guess that since only one thread is changing the value, setting fraction to volatile should be enough. Regards, Ismael |