Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

A SwingWorker and javax.swing.Timer issue?

796293Jun 8 2009 — edited Jul 8 2009
Hi All,

I was looking for some programming advice on what's the best way to deal with this problem. I have a SwingWorker that executes a system task that can vary quite widely in execution time. Also I have javax.swing.Timers that calls methods for animating the front-end of a GUI.
Now when the SwingWorker kicks off it will, during its lifecycle it will make various calls to these 'animation Timers' updating the front-end on the progress of the SwingTimer.

Now heres the problem, while the animations have fixed time delays to enable smooth animations, it is possible for the swingWorker to make a call to an animation timer, complete its task before the animation timer completes and make another call to the animation timer. This results in the animation graphics becomming flickery as two timers are running concurrently. Is there a good method of preventing timing issues like this?

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2009
Added on Jun 8 2009
2 comments
383 views