com.sun.opengl.util
Class Animator
An Animator can be attached to one or more
GLAutoDrawable
s to drive their display() methods in a loop.
The Animator class creates a background thread in which the
calls to
display()
are performed. After each drawable
has been redrawn, a brief pause is performed to avoid swamping the
CPU, unless
setRunAsFastAsPossible(boolean)
has been called.
void | add(GLAutoDrawable drawable) - Adds a drawable to the list managed by this Animator.
|
protected void | display() - Called every frame to cause redrawing of all of the
GLAutoDrawables this Animator manages.
|
Iterator | drawableIterator() - Returns an iterator over the drawables managed by this
Animator.
|
boolean | isAnimating() - Indicates whether this animator is currently running.
|
void | remove(GLAutoDrawable drawable) - Removes a drawable from the list managed by this Animator.
|
void | setIgnoreExceptions(boolean ignoreExceptions) - Sets a flag causing this Animator to ignore exceptions produced
while redrawing the drawables.
|
void | setPrintExceptions(boolean printExceptions) - Sets a flag indicating that when exceptions are being ignored by
this Animator (see
setIgnoreExceptions(boolean) ), to print the
exceptions' stack traces for diagnostic information.
|
void | setRunAsFastAsPossible(boolean runFast) - Sets a flag in this Animator indicating that it is to run as
fast as possible.
|
void | start() - Starts this animator.
|
void | stop() - Stops this animator.
|
ignoreExceptions
protected boolean ignoreExceptions
printExceptions
protected boolean printExceptions
Animator
public Animator()
Creates a new, empty Animator.
Animator
public Animator(GLAutoDrawable drawable)
Creates a new Animator for a particular drawable.
add
public void add(GLAutoDrawable drawable)
Adds a drawable to the list managed by this Animator.
display
protected void display()
Called every frame to cause redrawing of all of the
GLAutoDrawables this Animator manages. Subclasses should call
this to get the most optimized painting behavior for the set of
components this Animator manages, in particular when multiple
lightweight widgets are continually being redrawn.
drawableIterator
public Iterator drawableIterator()
Returns an iterator over the drawables managed by this
Animator.
isAnimating
public boolean isAnimating()
Indicates whether this animator is currently running. This
should only be used as a heuristic to applications because in
some circumstances the Animator may be in the process of
shutting down and this method will still return true.
remove
public void remove(GLAutoDrawable drawable)
Removes a drawable from the list managed by this Animator.
setIgnoreExceptions
public void setIgnoreExceptions(boolean ignoreExceptions)
Sets a flag causing this Animator to ignore exceptions produced
while redrawing the drawables. By default this flag is set to
false, causing any exception thrown to halt the Animator.
setPrintExceptions
public void setPrintExceptions(boolean printExceptions)
Sets a flag indicating that when exceptions are being ignored by
this Animator (see
setIgnoreExceptions(boolean)
), to print the
exceptions' stack traces for diagnostic information. Defaults to
false.
setRunAsFastAsPossible
public final void setRunAsFastAsPossible(boolean runFast)
Sets a flag in this Animator indicating that it is to run as
fast as possible. By default there is a brief pause in the
animation loop which prevents the CPU from getting swamped.
This method may not have an effect on subclasses.
start
public void start()
Starts this animator.
stop
public void stop()
Stops this animator. In most situations this method blocks until
completion, except when called from the animation thread itself
or in some cases from an implementation-internal thread like the
AWT event queue thread.
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.