|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
Facade
public class Facade
An interface between the GUI and the kernel classes in a checkers game.
Field Summary | |
---|---|
Player |
activePlayer
|
static int |
CLIENTGAME
|
static int |
HOSTGAME
|
static java.lang.String |
ID
|
static int |
LOCALGAME
|
Player |
passivePlayer
|
static java.lang.String |
playerSwitch
|
Board |
theBoard
|
Driver |
theDriver
|
LocalPlayer |
theLocalPlayer
|
static java.lang.String |
update
|
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 | |
---|---|
Facade(Board newBoard,
Driver newDriver)
Constructor for the facade. |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener a)
Adds an action listener to the facade |
void |
createPlayer(int num,
int type)
Create a player with the given type and player number. |
void |
endGameAccepted()
Called when both players have clicked OK on the end game dialog box |
void |
generateActionPerformed()
Generates an action. |
java.lang.String |
getPlayerName(int playerNum)
Given a player number, returns the name associated with that number. |
int |
getTimer()
Returns the timer value, how long each player get to take a turn |
int |
getTimerWarning()
Returns the amount of time chosen for a warning that a player is near the end of his/her turn. |
void |
pressAcceptDraw()
Tell the kernel that the user has accepted a draw. |
void |
pressDraw()
Tell the kernel 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 |
setGameMode(int mode)
Set the game mode: a local game or a network game |
void |
setHost(java.net.URL host)
Tell the kernel to connect to the specified host to start a network game. |
void |
setPlayerModes(Player active,
Player passive)
Set which players turn it is. |
void |
setPlayerName(int playerNum,
java.lang.String name)
Tell the kernel to associate the given name with the given player number. |
void |
setTimer(int time,
int warning)
Tell the kernel to set a time limit for each turn. |
void |
showEndGame(java.lang.String message)
Display to local players that the game has ended with the message provided. |
void |
startGame()
Call the driver and begin the game. |
Board |
stateOfBoard()
Notifies everything of the sta eof the board |
int |
whosTurn()
Return an int indicating which player's turn it is. |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int LOCALGAME
public static int HOSTGAME
public static int CLIENTGAME
public static java.lang.String update
public static java.lang.String playerSwitch
public static java.lang.String ID
public Driver theDriver
public LocalPlayer theLocalPlayer
public Board theBoard
public Player passivePlayer
public Player activePlayer
Constructor Detail |
---|
public Facade(Board newBoard, Driver newDriver)
newBoard
- Board object Facade will manipulate.newDriver
- Driver object that will communicate
with the Facade.Method Detail |
---|
public int whosTurn()
public void setPlayerModes(Player active, Player passive)
active
- The active playerpassive
- The passive playerpublic 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 java.lang.String getPlayerName(int playerNum)
playerNum
- the number of a player
public void setPlayerName(int playerNum, java.lang.String name)
playerNum
- the number of a playername
- the name that player should be givenpublic void setTimer(int time, int warning) throws java.lang.Exception
time
- the time limit for each turn, in seconds.
java.lang.Exception
public void setHost(java.net.URL host)
host
- public void showEndGame(java.lang.String message)
message
- public void setGameMode(int mode) throws java.lang.Exception
the
- mode of the game
java.lang.Exception
public int getTimer()
public int getTimerWarning()
public void addActionListener(java.awt.event.ActionListener a)
public void endGameAccepted()
public Board stateOfBoard()
public void startGame()
public void generateActionPerformed()
public void createPlayer(int num, int type)
num
- Int for player number (either 1 or 2)type
- Int for type of player (Local, network, etc.)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |