|
|||||||||
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 Artist s. |
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 String
s to the Artist
s that handle Cells of the specified type.public IgelViewKurmas(IGameState gameState)
gameState
- object describing the state of the gameMethod Detail |
---|
public void addCellActionListener(CellActionListener cellActionListener)
IIgelView
addCellActionListener
in interface IIgelView
cellActionListener
- the listenerpublic void addMouseListener(int row, int col, java.awt.event.MouseListener listener)
IIgelView
[row, col]
addMouseListener
in interface IIgelView
row
- the rowcol
- the columnlistener
- a MouseListener
public void update(IGameState state)
IIgelView
update
in interface IIgelView
state
- the current game statepublic void addPassSidewaysMovePressedListener(java.awt.event.ActionListener actionListener)
IIgelView
addPassSidewaysMovePressedListener
in interface IIgelView
actionListener
- a listener to respond when the user presses the "passSidewaysMove" button.public void enableSidewaysViewButton(boolean enable)
IIgelView
enableSidewaysViewButton
in interface IIgelView
enable
- 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 IIgelView
message
- 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 IIgelView
public void addMenu(javax.swing.JMenuBar menu)
IIgelView
addMenu
in interface IIgelView
menu
- the menupublic void setProposedMoveSource(int row, int column)
setProposedMoveSource
in interface IIgelView
row
- the rowcolumn
- the column
java.lang.IllegalArgumentException
- if either row
or column
is not validpublic void setProposedMoveTarget(int row, int column, int player)
setProposedMoveTarget
in interface IIgelView
row
- 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 IIgelView
public void updateMessage(java.lang.String newMessage)
IIgelView
updateMessage
in interface IIgelView
newMessage
- the new message to displaypublic void updateDie(int newValue)
IIgelView
updateDie
in interface IIgelView
newValue
- the new value for the diepublic static java.util.Map<java.lang.String,Artist> defaultArtistMap()
Artist
s.
Artist
s.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |