public class SwingAnimator extends java.lang.Object implements Animator
Animator
, using a JFrame
to display the animation. The JFrame
is created and
displayed by the constructor.
Calls to update()
result in a call to
painter.paint()
. This is executed in the swing
thread while the main thread is paused for delay
milliseconds.Constructor and Description |
---|
SwingAnimator(SwingAnimatorPainter painter,
java.lang.String name,
int width,
int height,
int delay)
Creates and displays a
JFrame for the animation. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Throw away this visualization.
|
void |
update(java.util.Observable model,
java.lang.Object ignored)
Calls to
update are executed in the swing thread,
while the main thread is paused for delay
milliseconds. |
public SwingAnimator(SwingAnimatorPainter painter, java.lang.String name, int width, int height, int delay)
JFrame
for the animation.name
- The name to be displayed on the graphical window.width
- The width of the display, in pixels.height
- The height of the display, in pixels.delay
- Time to pause after an update, in milliseconds.public void dispose()
public void update(java.util.Observable model, java.lang.Object ignored)
update
are executed in the swing thread,
while the main thread is paused for delay
milliseconds.update
in interface java.util.Observer