|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--thegame.client.GameField
The gamefield. Holds a fixed amount of GameSquares and methods to control their look and behaviour.
Inner classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
static int |
FIELD_SIZE
The size of gameField. |
protected GameSquare[][] |
gameField
The gamefield. |
protected boolean |
isChanged
Is true if the local player has made a move and the isChanged() method has not been called yet; is false otherwise. |
protected boolean |
isDrawingCircles
Is true if the local player is drawing circles; is false if the local player is drawing crosses. |
protected boolean |
isFinished
Is true if the local player has made a winning move; is false otherwise. |
protected boolean |
isLocalPlayerLastMoveHighlighted
Is true if the local player's last move is to be highlighted; is false otherwise. |
protected boolean |
isLocalPlayerMove
Is true if the local player can make a move; is false otherwise. |
protected boolean |
isRemotePlayerLastMoveHighlighted
Is true if the remote player's last move is to be highlighted; is false otherwise. |
protected int[] |
localPlayerLastMove
Holds the coordinates of the last move by the local player. |
protected java.awt.event.ActionListener |
ON_GAME_SQUARE_CLICK
The ActionListener for all the GameSquares. |
protected int[] |
remotePlayerLastMove
Holds the coordinates of the last move by the remote player. |
static int |
SQUARE_SIZE
The size of a GameSquare in pixels. |
static int |
SQUARES_TO_WIN
The minimum amount of squares in row needed for winning. |
protected int[][] |
winningSquares
Holds the winning squares if a winning move has been made. |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 | |
GameField(boolean isDrawingCircles)
Constructs a GameField. |
Method Summary | |
int[][] |
findWinningSquares(int[] position)
Finds a winning row around the specified position. |
int[] |
getMove()
Returns the coordinates of the last move made by the local player. |
int[][] |
getWinningSquares()
Returns the coordinates of the winning squares, or null if the local player has made no winning move. |
boolean |
isChanged()
Returns the isChanged property. |
boolean |
isFinished()
Returns the isFinished property. |
void |
reset(boolean enabled)
Resets the gamefield. |
void |
setClosed()
Closes the gamefield. |
void |
setEnabled(boolean isEnabled)
Enables or disables user input. |
void |
setLocalPlayerLastSquareHighlighted(boolean isHighlighted)
Sets whether or not the last square that the local player clicked on is to be highlighted. |
void |
setRemotePlayerClickedSquare(int[] square)
Sets the specified square clicked by the remote player. |
void |
setRemotePlayerLastSquareHighlighted(boolean isHighlighted)
Sets whether or not the last square that the remote player clicked on is to be highlighted. |
void |
setWinningSquares(int[][] squares)
Marks the specified squares as a winning row and highlights them in a special way. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUIClassID, paramString, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getWidth, getVisibleRect, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FIELD_SIZE
protected GameSquare[][] gameField
protected boolean isChanged
protected boolean isDrawingCircles
protected boolean isFinished
protected boolean isLocalPlayerLastMoveHighlighted
protected boolean isLocalPlayerMove
protected boolean isRemotePlayerLastMoveHighlighted
protected int[] localPlayerLastMove
protected final java.awt.event.ActionListener ON_GAME_SQUARE_CLICK
protected int[] remotePlayerLastMove
public static final int SQUARE_SIZE
public static final int SQUARES_TO_WIN
protected int[][] winningSquares
Constructor Detail |
public GameField(boolean isDrawingCircles)
isDrawingCircles
- true if the local player is drawing circles; false if the local player is drawing crossesMethod Detail |
public int[][] findWinningSquares(int[] position)
position
- the position to be searched aroundpublic int[] getMove()
public int[][] getWinningSquares()
public boolean isChanged()
public boolean isFinished()
public void reset(boolean enabled)
enabled
- true if user input is allowed; false if user input is forbiddenpublic void setClosed()
public void setEnabled(boolean isEnabled)
setEnabled
in class javax.swing.JComponent
isEnabled
- true if user input is allowed; false if user input is forbiddenpublic void setLocalPlayerLastSquareHighlighted(boolean isHighlighted)
isHighlighted
- true if the last square is to be highlighted; false if the last square is not to be highlightedpublic void setRemotePlayerClickedSquare(int[] square)
square
- the square clickedpublic void setRemotePlayerLastSquareHighlighted(boolean isHighlighted)
isHighlighted
- true if the last square is to be highlighted; false if the last square is not to be highlightedpublic void setWinningSquares(int[][] squares)
squares
- the squares to be marked
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |