sprite
Class Sprite

java.lang.Object
  extended by sprite.Sprite
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SoundSprite, Sprite2D

public abstract class Sprite
extends java.lang.Object
implements java.io.Serializable

Last updated September 21, 2006
The base sprite bean. All other sprites inherit this class.
Establishes basic sprite properties common to all sprites.

Version:
m.2
Author:
Eric Angeli
See Also:
Serialized Form

Field Summary
protected  boolean active
          Whether the sprite is active or not.
protected  boolean visible
          Whether the sprite is visible or not.
 
Constructor Summary
Sprite()
          Creates a new sprite.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds the property change listener.
 java.beans.PropertyChangeSupport getPropertySupport()
          Gets the property change support.
 boolean isActive()
          Gets the active status of the sprite.
 boolean isVisible()
          Gets the visiblity of the sprite.
abstract  void paintSprite(java.awt.Graphics2D g)
          abstract paint method.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes the property change listener.
 void restore()
          Restores the sprite.
 void setActive(boolean active)
          Sets the active status of the sprite.
 void setVisible(boolean visible)
          Sets the visibility of the sprite.
 void suspend()
          Stops the sprite.
abstract  void updateSprite(java.awt.Component c)
          abstract updateSprite.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

visible

protected boolean visible
Whether the sprite is visible or not.


active

protected boolean active
Whether the sprite is active or not.

Constructor Detail

Sprite

public Sprite()
Creates a new sprite.

Method Detail

paintSprite

public abstract void paintSprite(java.awt.Graphics2D g)
abstract paint method.

Parameters:
g - The graphics to paint with.

updateSprite

public abstract void updateSprite(java.awt.Component c)
abstract updateSprite.
Should be used to update the sprite in sub classes.

Parameters:
c - The owner of the sprite.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the property change listener.

Parameters:
listener - The new listener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the property change listener.

Parameters:
listener - The listener to remove.

getPropertySupport

public java.beans.PropertyChangeSupport getPropertySupport()
Gets the property change support.

Returns:
The property support for this sprite.

suspend

public void suspend()
Stops the sprite.
Sets visible and active to false.


restore

public void restore()
Restores the sprite.
Sets visible and active to true.


isVisible

public boolean isVisible()
Gets the visiblity of the sprite.

Returns:
Boolean value representing the visibility of the sprite.

setVisible

public void setVisible(boolean visible)
Sets the visibility of the sprite.

Parameters:
visible - Whether the sprite is visible or not.

isActive

public boolean isActive()
Gets the active status of the sprite.

Returns:
Boolean value representing the active status of the sprite.

setActive

public void setActive(boolean active)
Sets the active status of the sprite.

Parameters:
active - Whether the sprite is active or not.