|
Breakout Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object breakout.Board
A class to manage lists of BreakoutComponents, provide simple autolayout
functionality, and maintain information about the geometry of the gameboard.
A Board is housed in a BoardPanel
, which manages the painting
of the Board and its members.
Field Summary | |
static int |
BORDER
The border autolayout keeps between the edge of the panel and where bricks start to appear. |
static int |
PADDING
The distance autolayout places between bricks. |
Constructor Summary | |
Board(BoardPanel bp)
Creates a new Board with the specified BoardPanel. |
Method Summary | |
void |
add(BreakoutComponent bc)
Autolayout adder: Adds a BreakoutComponent to the board in the next available spot in the grid. |
void |
add(BreakoutComponent bc,
java.awt.Point p)
Explicit adder: Adds a BreakoutComponent to the Board at the specified Point. |
void |
addDefaultBallPaddle()
Adds a BasicPaddle and BasicBall to the board in default locations. |
void |
addDefaultWalls()
Adds four BasicWall s to the board, including the floor. |
void |
disableLayout()
Disables autolayout in preparation for beginning the game. |
java.util.Iterator |
getAllComponents()
Gives an Iterator for all the BreakoutComponents on the board. |
BoardPanel |
getBoardPanel()
Gets the BoardPanel used to display this Board. |
int |
getHeight(boolean padding)
Gets the height of the board, with or without the border padding. |
java.awt.Point |
getLowerLeft(boolean padding)
Gets the lower-left point on the board, with or without the border padding. |
java.awt.Point |
getLowerRight(boolean padding)
Gets the lower-right point on the board, with or without the border padding. |
java.util.Iterator |
getReboundingComponents()
Gives an Iterator for all the BreakoutComponents on the board that implement Rebounding. |
java.awt.Point |
getUpperLeft(boolean padding)
Gets the upper-left point on the board, with or without the border padding. |
java.awt.Point |
getUpperRight(boolean padding)
Gets the upper-right point on the board, with or without the border padding. |
int |
getWidth(boolean padding)
Gets the width of the board, with or without border padding. |
boolean |
hasBallInPlay()
Tells if there are any Ball objects left on the Board. |
boolean |
hasBricksLeft()
Tells if there are any Brick objects left on the Board. |
void |
removeReboundingElement(BreakoutComponent bc)
Fully removes from the board a Rebounding BreakoutComponent which died during the bounce phase of the tick. |
void |
setBoardPanel(BoardPanel bp)
Sets the BoardPanel for this Board. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PADDING
public static final int BORDER
Constructor Detail |
public Board(BoardPanel bp)
bp
- the BoardPanel used to display this Board.Method Detail |
public void setBoardPanel(BoardPanel bp)
bp
- the BoardPanel used to display this Board.public BoardPanel getBoardPanel()
public void disableLayout()
public void add(BreakoutComponent bc, java.awt.Point p)
bc
- the BreakoutComponent to be added.p
- the Point representing the intended location of the object.public void add(BreakoutComponent bc)
this.getWidth(true)
and this.getHeight(true)
.
public void addDefaultWalls()
BasicWall
s to the board, including the floor.
public void addDefaultBallPaddle()
public void removeReboundingElement(BreakoutComponent bc)
bc
- The Rebounding/BreakoutComponent object that died.public java.util.Iterator getAllComponents()
public java.util.Iterator getReboundingComponents()
public boolean hasBricksLeft()
true
if there are Bricks left; false
otherwise.public boolean hasBallInPlay()
true
if there are Balls left; false
otherwise.public java.awt.Point getUpperLeft(boolean padding)
padding
- If true, returns the point where autolayout adds the first brick. Otherwise,
returns the upperleftmost point of the BoardPanel.
public java.awt.Point getUpperRight(boolean padding)
padding
- If true, returns the point where autolayout thinks upper-right is. Otherwise,
returns the upperrightmost point of the BoardPanel.
public java.awt.Point getLowerLeft(boolean padding)
padding
- If true, returns the point where autolayout thinks lower-left is. Otherwise,
returns the lowerleftmost point of the BoardPanel.
public java.awt.Point getLowerRight(boolean padding)
padding
- If true, returns the point where autolayout thinks lower-right is. Otherwise,
returns the lowerrightmost point of the BoardPanel.
public int getHeight(boolean padding)
padding
- If true, returns the height autolayout uses. Otherwise, returns the height of
the BoardPanel.
public int getWidth(boolean padding)
padding
- If true, returns the width autolayout uses. Otherwise, returns the width
of the BoardPanel.
|
Breakout Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |