java.lang.Object
java.awt.Component
java.awt.Canvas
com.adorphuye.othello.gui.Board
- All Implemented Interfaces:
- javax.accessibility.Accessible, com.adorphuye.othello.gui.board.BoardListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
- public class Board
- extends java.awt.Canvas
- implements com.adorphuye.othello.gui.board.BoardListener
This class is the visual representation of an Othello (also known as Reversi) board.
| Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Fields inherited from class java.awt.Canvas |
|
|
Constructor Summary |
Board()
Creates a new instance of this class. |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, 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, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
renderer
private com.adorphuye.othello.gui.board.BoardCellRenderer renderer
data
private com.adorphuye.othello.gui.board.BoardDataModel data
HORIZONTAL_CELL_SIZE
public static final int HORIZONTAL_CELL_SIZE
- See Also:
- Constant Field Values
VERTICAL_CELL_SIZE
public static final int VERTICAL_CELL_SIZE
- See Also:
- Constant Field Values
imgs
public static java.awt.Image[] imgs
colorMap
private java.util.Vector colorMap
img
private java.awt.Image img
cmg
private java.awt.Image cmg
gBuffer
private java.awt.Graphics gBuffer
cBuffer
private java.awt.Graphics cBuffer
BOARD_2_BOARD
private int BOARD_2_BOARD
BOARD_2_BLACK
private int BOARD_2_BLACK
BOARD_2_WHITE
private int BOARD_2_WHITE
BLACK_2_WHITE
private int BLACK_2_WHITE
WHITE_2_BLACK
private int WHITE_2_BLACK
path
private int[][] path
animating
private boolean animating
theEvent
private com.adorphuye.othello.gui.board.BoardEvent theEvent
frameNum
private int frameNum
Board
public Board()
- Creates a new instance of this class.
lz
private java.lang.String lz(int i)
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Description copied from class:
java.awt.Component
- Returns the component's preferred size.
getMaximumSize
public java.awt.Dimension getMaximumSize()
- Description copied from class:
java.awt.Component
- Returns the component's maximum size.
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Description copied from class:
java.awt.Component
- Returns the component's minimum size.
putMapping
public void putMapping(int key,
java.lang.Object obj)
getMapping
public java.lang.Object getMapping(int key)
removeColourMap
public void removeColourMap(java.lang.Object key)
toBoardCoordinate
public java.awt.Point toBoardCoordinate(java.awt.Point p)
toCanvasCoordinates
public java.awt.Point toCanvasCoordinates(java.awt.Point p)
setCellRenderer
public void setCellRenderer(com.adorphuye.othello.gui.board.BoardCellRenderer r)
- Sets the renderer that will be used to render game pieces on this board.
getCellRenderer
public com.adorphuye.othello.gui.board.BoardCellRenderer getCellRenderer()
- Returns the current renderer used by this board to render game pieces.
setModel
public void setModel(com.adorphuye.othello.gui.board.BoardDataModel m)
getModel
public com.adorphuye.othello.gui.board.BoardDataModel getModel()
getXIntervals
public int getXIntervals()
getYIntervals
public int getYIntervals()
update
public void update(java.awt.Graphics g)
- Description copied from class:
java.awt.Canvas
- Updates the canvas in response to a request to
repaint() it. The canvas is cleared
with the current background colour, before paint()
is called to add the new contents. Subclasses
which override this method should either call this
method via super.update(graphics) or re-implement
this behaviour, so as to ensure that the canvas is
clear before painting takes place.
repaint
public void repaint(java.awt.Point p)
paint
public void paint(java.awt.Graphics g)
- Description copied from class:
java.awt.Canvas
- Repaints the canvas window. This method should be overridden by
a subclass to do something useful, as this method simply paints
the window with the background color.
boardChanged
public void boardChanged(com.adorphuye.othello.gui.board.BoardEvent evt)
- Specified by:
boardChanged in interface com.adorphuye.othello.gui.board.BoardListener
reshape
public void reshape(int param,
int param1,
int param2,
int param3)
- Description copied from class:
java.awt.Component
- Sets the bounding rectangle for this component to the specified values.
Note that these coordinates are relative to the parent, not to the screen.