com.yost.util
Class AnimationExecutor

java.lang.Object
  extended by com.yost.util.AnimationExecutor

public class AnimationExecutor
extends Object

An Executor-like class that executes animation tasks serially in the AWT Event Thread. This class allows you to manage type-ahead or click-ahead in situations where each user input starts an animation.

An animation is typically a chain of runnables, starting with a runnable that runs in the Event thread, which chains to a runnable that does a delay in another thread, which chains to another runnable that runs in the Event thread (using invokeLater), and so on until a final runnable runs in the Event thread.

Here is a scenario to show how this class works.

This executor doesn't run a Runnable. Instead it runs an AnimationExecutor.Task, which has a run method that takes two arguments. The first argument tells the task whether any other animations are queued. The second argument is a Runnable the task must run when it completes.

http://Yost.com/computers/java/AnimationExecutor Public Domain

Version:
2007-08-17
Author:
Dave@Yost.com

Nested Class Summary
static interface AnimationExecutor.Task
          The animation task to be run.
 
Constructor Summary
AnimationExecutor()
           
 
Method Summary
 void execute(AnimationExecutor.Task task)
          Execute a task in the Event thread, serialized with all other tasks submitted via this executor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationExecutor

public AnimationExecutor()
Method Detail

execute

public void execute(AnimationExecutor.Task task)
Execute a task in the Event thread, serialized with all other tasks submitted via this executor.

Parameters:
task - EventThreadSerializedExecutor.Task