visual.dynamic.described
Class Stage

java.lang.Object
  extended by visual.Visualization
      extended by visual.dynamic.described.Stage
All Implemented Interfaces:
MetronomeListener

public class Stage
extends Visualization
implements MetronomeListener

A Visualization that contains Sprite objects

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Constructor Summary
Stage(int timeStep)
          Explicit Value Constructor
Stage(int timeStep, Metronome metronome)
          Explicit Value Constructor
 
Method Summary
 void add(Sprite sprite)
          Add a Sprite to this Stage
 Metronome getMetronome()
          Get the Metronome that this Stage is using
 void handleTick(int time)
          Handle "tick" events (required by MetronomeTickListener)>
 void remove(Sprite sprite)
          Remove a Sprite from this Stage
 void setRestartTime(int restartTime)
          Set the time at which the Stage should restart
 void start()
          Start the Stage
 void stop()
          Stop the Stage
 
Methods inherited from class visual.Visualization
add, addKeyListener, addMouseListener, addMouseMotionListener, addView, clear, createDefaultView, getView, getViews, iterator, remove, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeView, repaint, setBackground, setView, toBack, toFront
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stage

public Stage(int timeStep)
Explicit Value Constructor

Parameters:
timeStep - Amount of time between ticks (in milliseconds)

Stage

public Stage(int timeStep,
             Metronome metronome)
Explicit Value Constructor

Parameters:
timeStep - Amount of time between ticks (in milliseconds)
metronome - The Metronome to use
Method Detail

add

public void add(Sprite sprite)
Add a Sprite to this Stage

Parameters:
sprite - The Sprite to add

getMetronome

public Metronome getMetronome()
Get the Metronome that this Stage is using

Returns:
The Metronome

handleTick

public void handleTick(int time)
Handle "tick" events (required by MetronomeTickListener)>

Specified by:
handleTick in interface MetronomeListener
Parameters:
time - The time of the "tick"

remove

public void remove(Sprite sprite)
Remove a Sprite from this Stage

Parameters:
sprite - The Sprite to remove

setRestartTime

public void setRestartTime(int restartTime)
Set the time at which the Stage should restart

Parameters:
restartTime - In milliseconds (negative to not restart)

start

public void start()
Start the Stage


stop

public void stop()
Stop the Stage



Design and Implementation of Multimedia Software, Jones and Bartlett Publishers