Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.adorphuye.othello.gui
Class Board  view Board download Board.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycom.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 Class Summary
 
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
 
Field Summary
private  boolean animating
           
private  int BLACK_2_WHITE
           
private  int BOARD_2_BLACK
           
private  int BOARD_2_BOARD
           
private  int BOARD_2_WHITE
           
private  java.awt.Graphics cBuffer
           
private  java.awt.Image cmg
           
private  java.util.Vector colorMap
           
private  com.adorphuye.othello.gui.board.BoardDataModel data
           
private  int frameNum
           
private  java.awt.Graphics gBuffer
           
static int HORIZONTAL_CELL_SIZE
           
private  java.awt.Image img
           
static java.awt.Image[] imgs
           
private  int[][] path
           
private  com.adorphuye.othello.gui.board.BoardCellRenderer renderer
           
private  com.adorphuye.othello.gui.board.BoardEvent theEvent
           
static int VERTICAL_CELL_SIZE
           
private  int WHITE_2_BLACK
           
 
Fields inherited from class java.awt.Canvas
 
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
Board()
          Creates a new instance of this class.
 
Method Summary
 void boardChanged(com.adorphuye.othello.gui.board.BoardEvent evt)
           
 com.adorphuye.othello.gui.board.BoardCellRenderer getCellRenderer()
          Returns the current renderer used by this board to render game pieces.
 java.lang.Object getMapping(int key)
           
 java.awt.Dimension getMaximumSize()
          Returns the component's maximum size.
 java.awt.Dimension getMinimumSize()
          Returns the component's minimum size.
 com.adorphuye.othello.gui.board.BoardDataModel getModel()
           
 java.awt.Dimension getPreferredSize()
          Returns the component's preferred size.
 int getXIntervals()
           
 int getYIntervals()
           
private  java.lang.String lz(int i)
           
 void paint(java.awt.Graphics g)
          Repaints the canvas window.
 void putMapping(int key, java.lang.Object obj)
           
 void removeColourMap(java.lang.Object key)
           
 void repaint(java.awt.Point p)
           
 void reshape(int param, int param1, int param2, int param3)
          Sets the bounding rectangle for this component to the specified values.
 void setCellRenderer(com.adorphuye.othello.gui.board.BoardCellRenderer r)
          Sets the renderer that will be used to render game pieces on this board.
 void setModel(com.adorphuye.othello.gui.board.BoardDataModel m)
           
 java.awt.Point toBoardCoordinate(java.awt.Point p)
           
 java.awt.Point toCanvasCoordinates(java.awt.Point p)
           
 void update(java.awt.Graphics g)
          Updates the canvas in response to a request to repaint() it.
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

Board

public Board()
Creates a new instance of this class.

Method Detail

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.