|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--minesweeper.MineFieldCell
A cell of the mine field.
Field Summary | |
private boolean |
bContainsAMine
Indicates whether this cells contains a mine. |
private boolean |
bIsRevealed
Indicates whether the real content of this cell is revealed. |
private boolean |
bPlayerSupposesAMine
Indicates whether the player thinks that this cell contains a mine. |
private JButton |
btnButton
The button displayed when the content of this cell is not revealed. |
private static JLabel[] |
DIGITS
An array of digits; these labels should not be modified. |
private static JLabel |
EMPTY
An empty cell. |
private static JLabel |
ERROR
A mine that was wrongly supposed. |
private static ImageIcon |
FLAG
A flag. |
private int |
iSurroundingMines
Stores the number of mines around this cell. |
private EventListenerList |
lstListeners
The list of listeners. |
private LinkedList |
lstSurrounders
The list of surrounders. |
private minesweeper.event.MineFieldCellEvent |
mfceEvent
The source of events. |
private static JLabel |
MINE
A mine. |
Constructor Summary | |
MineFieldCell()
Creates a new mine field cell. |
Method Summary | |
(package private) static void |
The "static constructor" of this class. |
void |
addListener(minesweeper.event.MineFieldCellListener mfclListener)
Adds the specified mine field cell listener to receive event from this cell. |
boolean |
doesContainAMine()
Indicates whether this cell has a mine. |
protected void |
fireDisplayChanged()
Fires a displayChanged event. |
protected void |
fireFlagAdded()
Fires a flagAdded event. |
protected void |
fireFlagRemoved()
Fires a flagRemoved event. |
protected void |
fireSteppedOnAMine()
Fires a steppedOnAMine event. |
Component |
getComponent()
Returns the Component that is to be used to render this mine field cell,
or null if the cell is empty with no mines around. |
int |
getSurroundingMineCount()
Indicates the number of mines around this cell. |
void |
increaseSurroundingMineCount()
Increase the number of mines around this cell. |
boolean |
isFlagged()
Indicates whether this cell has a flag. |
boolean |
isRevealed()
Indicates whether the real content of this cell is revealed. |
void |
registerAsSurrounder(MineFieldCell mfcSurrounder)
Registers the specified mine field cell as a surrounder of this one. |
void |
removeListener(minesweeper.event.MineFieldCellListener mfclListener)
Removes the specified mine field cell listener so that it no longer receive events from this cell. |
void |
reset()
Reset the mine field cell. |
void |
reveal()
Reveals the content of this cell. |
void |
revealError()
Reveals the content of this cell if the user assumption was wrong. |
void |
revealSurrounders()
Reveals the surrounders of this cell, if this cell is already revealed and the number of surrounding flags matches the number of surrounding mines. |
void |
settleAMine()
Settles a mine in this cell. |
void |
toggleFlag()
Toggles the flag. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Field Detail |
private static final JLabel EMPTY
private static final JLabel ERROR
private static final JLabel MINE
private static final ImageIcon FLAG
private static final JLabel[] DIGITS
private final JButton btnButton
private final LinkedList lstSurrounders
private boolean bContainsAMine
private boolean bPlayerSupposesAMine
private boolean bIsRevealed
private int iSurroundingMines
private final EventListenerList lstListeners
private minesweeper.event.MineFieldCellEvent mfceEvent
Constructor Detail |
public MineFieldCell()
Method Detail |
static void()
public Component getComponent()
Component
that is to be used to render this mine field cell,
or null
if the cell is empty with no mines around.public boolean doesContainAMine()
public int getSurroundingMineCount()
public boolean isFlagged()
public boolean isRevealed()
public void increaseSurroundingMineCount()
public void registerAsSurrounder(MineFieldCell mfcSurrounder)
public void reset()
public void reveal()
public void revealError()
public void revealSurrounders()
public void settleAMine()
public void toggleFlag()
public void addListener(minesweeper.event.MineFieldCellListener mfclListener)
public void removeListener(minesweeper.event.MineFieldCellListener mfclListener)
protected void fireDisplayChanged()
protected void fireFlagAdded()
protected void fireFlagRemoved()
protected void fireSteppedOnAMine()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |