All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class kpalin.alabra.BoardTile

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----kpalin.alabra.BoardTile

public class BoardTile
extends Canvas
This is the visual representation of a tile on the board.

Author:
Kimmo Palin

Variable Index

 o BLACKTILE
Tile color for black tiles.
 o piece
Piece on this tile.
 o selected
Wheather this tile is selected.
 o SELECTEDTILE
Tile color for selected tile.
 o WHITETILE
Tile color for white tiles.
 o xpos
Position of the tile.
 o ypos

Constructor Index

 o BoardTile(int, int)
Creates new empty Tile.

Method Index

 o getColumnCode()
Helps with move-history keeping.
 o getPiece()
Accessor for piece on this tile.
 o paint(Graphics)
Here we draw the image of the piece on the tile if there is one.
 o setBgColor()
Sets normal background color for a tile.
 o setPiece(Piece)
Accessor for piece on this tile.
 o setSelected()
Switch for selection.
 o setSelected(boolean)
Changes selection status.
 o toString()

Variables

 o WHITETILE
 static final Color WHITETILE
Tile color for white tiles.

 o BLACKTILE
 static final Color BLACKTILE
Tile color for black tiles.

 o SELECTEDTILE
 static final Color SELECTEDTILE
Tile color for selected tile.

 o piece
 private Piece piece
Piece on this tile.

 o selected
 private boolean selected
Wheather this tile is selected.

 o xpos
 final int xpos
Position of the tile. Read only.

 o ypos
 final int ypos

Constructors

 o BoardTile
 BoardTile(int x,
           int y)
Creates new empty Tile.

Parameters:
x - Column of the tile.
y - Row of the tile.

Methods

 o getPiece
 Piece getPiece()
Accessor for piece on this tile.

Returns:
Piece on this tile. null if there isn't one.
 o setPiece
 void setPiece(Piece p)
Accessor for piece on this tile.

Parameters:
p - Piece to set on this tile. Null to clear tile.
 o setBgColor
 private void setBgColor()
Sets normal background color for a tile.

 o paint
 public void paint(Graphics g)
Here we draw the image of the piece on the tile if there is one.

Overrides:
paint in class Canvas
 o setSelected
 void setSelected()
Switch for selection. Changes background color.

 o setSelected
 void setSelected(boolean select)
Changes selection status.

Parameters:
select - True if select, false if de-select.
 o getColumnCode
 char getColumnCode()
Helps with move-history keeping.

Returns:
s Column code (a-h) of the tile.
 o toString
 public String toString()
Overrides:
toString in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index