|
Breakout Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object breakout.DefaultBreakoutComponent
abstract class DefaultBreakoutComponent provides a partial implementation of the BreakoutComponent interface. It manages the position, size, shape, death, and transient parts of the BreakoutComponent, leaving the implementation of paint and hitBy to the subclass. The shape is a rectangle.
BreakoutComponent
,
breakout.BenSimpleBrick
Constructor Summary | |
DefaultBreakoutComponent(java.awt.Point location,
java.awt.Dimension size)
without world constructor. |
|
DefaultBreakoutComponent(java.awt.Point location,
java.awt.Dimension size,
World w)
Default constructor creates the component at a given location and size. |
Method Summary | |
java.awt.Point |
getCenter()
returns a point that corresponds to the center of the component. |
java.awt.Point |
getLocation()
returns a new Point corresponding to the location of the component's upper-left corner. |
java.awt.Shape |
getShape()
returns a Rectangle at location with size. |
java.awt.Dimension |
getSize()
returns the Dimensions of the component. |
abstract void |
hitBy(BreakoutComponent striker)
subclasses must implement the hitBy method to have the component react to being struck. |
boolean |
isDead()
returns dead status of component. |
boolean |
isTransient()
The default component is not transient. |
void |
kill()
destroys this component |
abstract void |
paint(java.awt.Graphics g)
subclasses must implement the paint method in order to draw their component. |
void |
setLocation(java.awt.Point location)
changes the location of the component's upper left corner to the given location. |
void |
setWorld(World world)
sets the world the component lives in |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultBreakoutComponent(java.awt.Point location, java.awt.Dimension size, World w)
location
- Initial location of component.size
- Initial size of component.w
- World the component lives in.public DefaultBreakoutComponent(java.awt.Point location, java.awt.Dimension size)
Method Detail |
public java.awt.Point getLocation()
getLocation
in interface BreakoutComponent
public void setLocation(java.awt.Point location)
setLocation
in interface BreakoutComponent
location
- Point to locate the component at.public java.awt.Point getCenter()
getCenter
in interface BreakoutComponent
public java.awt.Dimension getSize()
getSize
in interface BreakoutComponent
public java.awt.Shape getShape()
getShape
in interface BreakoutComponent
public void kill()
BreakoutComponent
kill
in interface BreakoutComponent
public boolean isDead()
BreakoutComponent
isDead
in interface BreakoutComponent
public boolean isTransient()
isTransient
in interface BreakoutComponent
public void setWorld(World world)
BreakoutComponent
setWorld
in interface BreakoutComponent
public abstract void paint(java.awt.Graphics g)
paint
in interface BreakoutComponent
g
- Graphics object used to draw with.public abstract void hitBy(BreakoutComponent striker)
hitBy
in interface BreakoutComponent
striker
- BreakoutComponent that struck this component
|
Breakout Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |