|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--World
A World is made up from a grid of square-shaped Cells.
Nested Class Summary | |
(package private) class |
World.CellListener
|
(package private) class |
World.DefaultFrame
The world is just a GUI component that needs to be added to a window. |
(package private) class |
World.WorldLayout
|
Field Summary |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
World(int colCount,
int rowCount,
WorldFrame frame)
Creates a new world with the specified number of columns and rows. |
Method Summary | |
void |
displayScore()
Displays the player's score. |
boolean |
gameIsOver()
Reveals whether the game is over. |
(package private) Cell |
getCell(int x,
int y)
Gets the cell at coordinates (x,y). |
int |
getCellClicks()
Returns the number of cells the player has clicked. |
int |
getFlaggedMines()
Get the number of mines that have been correctly flagged. |
int |
getFlaggedNonMines()
Get the number of cells that have been incorrectly flagged. |
void |
setCellClicks(int clicks)
Sets the number of cells the player has clicked. |
void |
setFlaggedMines(int mines)
Set the number of mines that have been correctly flagged. |
void |
setFlaggedNonMines(int cells)
Set the number of cells that have been incorrectly flagged. |
void |
setGameOver(boolean gameState)
Sets the game over state to true or false. |
Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public World(int colCount, int rowCount, WorldFrame frame)
colCount
- the number of columns in the world.rowCount
- the number of rows in the world.frame
- a window that you have created to contain this world.Method Detail |
public void displayScore()
public boolean gameIsOver()
Cell getCell(int x, int y)
x
- the x coordinatey
- the y coordinate
public int getCellClicks()
public int getFlaggedMines()
public int getFlaggedNonMines()
public void setCellClicks(int clicks)
clicks
- the desired number of clickspublic void setFlaggedMines(int mines)
public void setFlaggedNonMines(int cells)
public void setGameOver(boolean gameState)
gameState
- true if setting game over, false otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |