java.lang.Object | +----java.awt.Event | +----cs005.app.Animator
This is the cs5 Animator. It is intended to provide multithreaded animation without actually having to worry about all those nasty Thread synchronization issues. That's why it's a class of Event rather than Thread. It will cause an App to call the Animator's action method every time interval.
How To Use it:
This creates an animator with the default interval of 100 miliseconds.
This creates an Animator with the specified interval.
This is the Abstract method for YOU to fill in!
The App calls this method every time it receives an Animator event,
which happens roughly every interval.
This method is called by the animateThread constantly.
This method sets the Interval to the specified number of milliseconds.
This method starts the Animation.
This method stops the Animation.
public Animator(App app)
This creates an animator with the default interval of 100 miliseconds.
public Animator(App app, long interval)
This creates an Animator with the specified interval. All Animators are created in the stopped state.
public void run()
This method is called by the animateThread constantly. It delivers itself as an event to the applet and then puts the Thread to sleep for a certain number of miliseconds.
public void start()
This method starts the Animation. You must call this method before the Animator does anything. The Animation starts by starting the Thread.
public void stop()
This method stops the Animation. All Animators are "stopped" when they are created.
public synchronized void setInterval(long milliseconds)
This method sets the Interval to the specified number of milliseconds.
public long getInterval()
public abstract void action()
This is the Abstract method for YOU to fill in!
The App calls this method every time it receives an Animator event,
which happens roughly every interval. You should fill in this
method with the code that you want to happen continuously.
All Packages Class Hierarchy This Package Previous Next Index