MrProper
MrProper

Reputation: 1580

Java animation periodical action

I have animation and I need it to periodically do something. How can I achieve that? I guess it could be done with another thread and sleep him for specified time. However I'm not sure about this solution.

Animation is very simple.

Upvotes: 3

Views: 141

Answers (2)

SingleShot
SingleShot

Reputation: 19131

You will definitely want to use the Java Timing Framework. It was created by the guys that wrote Filthy Rich Clients which is about making very rich Swing apps. Writing your own timers/threads to do this is difficult to do right, plus the timing framework is clean and has helper methods ready to go.

Upvotes: 4

mKorbel
mKorbel

Reputation: 109813

if you want to moving with something in the Swing then you have to use javax.swing.Timer, example here

Upvotes: 5

Related Questions