|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgvprojects.igel.view.IgelViewKurmas
public class IgelViewKurmas
Example view for IgelArgern
| Constructor Summary | |
|---|---|
IgelViewKurmas(IGameState gameState)
Constructor that uses a default artist map. |
|
IgelViewKurmas(IGameState gameState,
java.util.Map<java.lang.String,Artist> map)
Constructor |
|
| Method Summary | |
|---|---|
void |
addCellActionListener(CellActionListener cellActionListener)
Add the specified listener to each cell in the board. |
void |
addMenu(javax.swing.JMenuBar menu)
Add a menu |
void |
addMouseListener(int row,
int col,
java.awt.event.MouseListener listener)
Add the specified mouse listener to the sell at location [row, col] |
void |
addPassSidewaysMovePressedListener(java.awt.event.ActionListener actionListener)
Add a listener to respond when the user presses the "passSidewaysMove" button. |
void |
clearProposedMove()
Cancels any currently displayed proposed moves. |
void |
close()
Close the view (i.e., dispose of the underlying JFrame. |
static java.util.Map<java.lang.String,Artist> |
defaultArtistMap()
Return the default mapping of cell types to Artists. |
void |
displayDialogMessage(java.lang.String message,
java.lang.String title)
Display a message in a dialog box |
void |
enableSidewaysViewButton(boolean enable)
Enable or disable the "Pass Sideways Move" button |
void |
setProposedMoveSource(int row,
int column)
Mark this cell as the starting point of a proposed move and suppress the drawing of this piece (because it is drawn translucently in the proposed target square). |
void |
setProposedMoveTarget(int row,
int column,
int player)
Specify that the user has proposed moving a hedgehog into the given cell and draw a translucent piece in the specified square. |
void |
update(IGameState state)
Update the view to reflect the current game state. |
void |
updateDie(int newValue)
Update the die to show the results of a recent roll |
void |
updateMessage(java.lang.String newMessage)
Updates the message that is displayed. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IgelViewKurmas(IGameState gameState,
java.util.Map<java.lang.String,Artist> map)
gameState - object describing the state of the game (The IGameState object describes the game
configuration: board size, location of obstacles, obstacle type, etc.)map - a map of Strings to the Artists that handle Cells of the specified type.public IgelViewKurmas(IGameState gameState)
gameState - object describing the state of the game| Method Detail |
|---|
public void addCellActionListener(CellActionListener cellActionListener)
IIgelView
addCellActionListener in interface IIgelViewcellActionListener - the listener
public void addMouseListener(int row,
int col,
java.awt.event.MouseListener listener)
IIgelView[row, col]
addMouseListener in interface IIgelViewrow - the rowcol - the columnlistener - a MouseListenerpublic void update(IGameState state)
IIgelView
update in interface IIgelViewstate - the current game statepublic void addPassSidewaysMovePressedListener(java.awt.event.ActionListener actionListener)
IIgelView
addPassSidewaysMovePressedListener in interface IIgelViewactionListener - a listener to respond when the user presses the "passSidewaysMove" button.public void enableSidewaysViewButton(boolean enable)
IIgelView
enableSidewaysViewButton in interface IIgelViewenable - true if the button is to be enabled, false if the button is to be disabled.
public void displayDialogMessage(java.lang.String message,
java.lang.String title)
IIgelView
displayDialogMessage in interface IIgelViewmessage - the main message (the one that appears in the center of the box)title - the title of the dialog boxpublic void close()
JFrame.
close in interface IIgelViewpublic void addMenu(javax.swing.JMenuBar menu)
IIgelView
addMenu in interface IIgelViewmenu - the menu
public void setProposedMoveSource(int row,
int column)
setProposedMoveSource in interface IIgelViewrow - the rowcolumn - the column
java.lang.IllegalArgumentException - if either row or column is not valid
public void setProposedMoveTarget(int row,
int column,
int player)
setProposedMoveTarget in interface IIgelViewrow - the rowcolumn - the columnplayer - the player number
java.lang.IllegalArgumentException - if either row or column are out of range.public void clearProposedMove()
IIgelView
clearProposedMove in interface IIgelViewpublic void updateMessage(java.lang.String newMessage)
IIgelView
updateMessage in interface IIgelViewnewMessage - the new message to displaypublic void updateDie(int newValue)
IIgelView
updateDie in interface IIgelViewnewValue - the new value for the diepublic static java.util.Map<java.lang.String,Artist> defaultArtistMap()
Artists.
Artists.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||