public class Animator
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
protected boolean |
ignoreExceptions |
protected boolean |
printExceptions |
Constructor and Description |
---|
Animator()
Creates a new, empty Animator.
|
Animator(GLAutoDrawable drawable)
Creates a new Animator for a particular drawable.
|
Modifier and Type | Method and Description |
---|---|
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.
|
java.util.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.
|
protected boolean ignoreExceptions
protected boolean printExceptions
public Animator()
public Animator(GLAutoDrawable drawable)
public void add(GLAutoDrawable drawable)
public void remove(GLAutoDrawable drawable)
public java.util.Iterator drawableIterator()
public void setIgnoreExceptions(boolean ignoreExceptions)
public void setPrintExceptions(boolean printExceptions)
setIgnoreExceptions(boolean)
), to print the
exceptions' stack traces for diagnostic information. Defaults to
false.public final void setRunAsFastAsPossible(boolean runFast)
protected void display()
public void start()
public boolean isAnimating()
public void stop()
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.