|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcheckers.controller.GameController
public class GameController
An interface between the GUI and the kernel classes in a checkers game.
Field Summary |
---|
Fields inherited from interface checkers.CheckersConstants |
---|
ACCEPT, BLUE, CLIENTGAME, DRAW, HOST, HOSTGAME, JOIN, KING, LOCAL, LOCALGAME, NUM_SPACES, PLAYER1SET, PLAYER2SET, RESIGN, SINGLE, UPDATE, WHITE |
Constructor Summary | |
---|---|
GameController(CheckersGame game)
Creates the controller with a reference to the game. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handles events |
void |
endGameAccepted()
Called when both players have clicked OK on the end game dialog box |
void |
pressAcceptDraw()
Tell the model that the user has accepted a draw. |
void |
pressDraw()
Tell the model that the user has requested a draw. |
void |
pressQuit()
Tell the kernel that the user has quit/resigned the game or quit the program |
void |
selectSpace(int space)
This method should be called to select a space on the board, either as the starting point or the ending point for a move. |
void |
setPlayer(int playerNum)
Sets the playerNum for a networked game. |
void |
setPlayerName(int playerNum,
java.lang.String name)
Tell the model to associate the given name with the given player number. |
void |
showEndGame(java.lang.String message)
Display to local players that the game has ended with the message provided. |
void |
startGame()
Begin the game |
void |
windowActivated(java.awt.event.WindowEvent arg0)
|
void |
windowClosed(java.awt.event.WindowEvent arg0)
|
void |
windowClosing(java.awt.event.WindowEvent arg0)
Called when the user tries to exit the program. |
void |
windowDeactivated(java.awt.event.WindowEvent arg0)
|
void |
windowDeiconified(java.awt.event.WindowEvent arg0)
|
void |
windowIconified(java.awt.event.WindowEvent arg0)
|
void |
windowOpened(java.awt.event.WindowEvent arg0)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GameController(CheckersGame game)
game
- CheckersGameMethod Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void selectSpace(int space)
space
- an int indicating which space to move to, according to the
standard checkers numbering scheme, left to right and top to
bottom.public void pressQuit()
public void pressDraw()
public void pressAcceptDraw()
public void setPlayerName(int playerNum, java.lang.String name)
playerNum
- the number of a playername
- the name that player should be givenpublic void showEndGame(java.lang.String message)
message
- public void endGameAccepted()
public void startGame()
public void setPlayer(int playerNum)
playerNum
- number of playerpublic void windowClosing(java.awt.event.WindowEvent arg0)
windowClosing
in interface java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent arg0)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent arg0)
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent arg0)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent arg0)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent arg0)
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent arg0)
windowDeactivated
in interface java.awt.event.WindowListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |