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
-
BLACKTILE
- Tile color for black tiles.
-
piece
- Piece on this tile.
-
selected
- Wheather this tile is selected.
-
SELECTEDTILE
- Tile color for selected tile.
-
WHITETILE
- Tile color for white tiles.
-
xpos
- Position of the tile.
-
ypos
-
-
BoardTile(int, int)
- Creates new empty Tile.
-
getColumnCode()
- Helps with move-history keeping.
-
getPiece()
- Accessor for piece on this tile.
-
paint(Graphics)
- Here we draw the image of the piece on the tile if there is one.
-
setBgColor()
- Sets normal background color for a tile.
-
setPiece(Piece)
- Accessor for piece on this tile.
-
setSelected()
- Switch for selection.
-
setSelected(boolean)
- Changes selection status.
-
toString()
-
WHITETILE
static final Color WHITETILE
- Tile color for white tiles.
BLACKTILE
static final Color BLACKTILE
- Tile color for black tiles.
SELECTEDTILE
static final Color SELECTEDTILE
- Tile color for selected tile.
piece
private Piece piece
- Piece on this tile.
selected
private boolean selected
- Wheather this tile is selected.
xpos
final int xpos
- Position of the tile. Read only.
ypos
final int ypos
BoardTile
BoardTile(int x,
int y)
- Creates new empty Tile.
- Parameters:
- x - Column of the tile.
- y - Row of the tile.
getPiece
Piece getPiece()
- Accessor for piece on this tile.
- Returns:
- Piece on this tile. null if there isn't one.
setPiece
void setPiece(Piece p)
- Accessor for piece on this tile.
- Parameters:
- p - Piece to set on this tile. Null to clear tile.
setBgColor
private void setBgColor()
- Sets normal background color for a tile.
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
setSelected
void setSelected()
- Switch for selection. Changes background color.
setSelected
void setSelected(boolean select)
- Changes selection status.
- Parameters:
- select - True if select, false if de-select.
getColumnCode
char getColumnCode()
- Helps with move-history keeping.
- Returns:
- s Column code (a-h) of the tile.
toString
public String toString()
- Overrides:
- toString in class Component
All Packages Class Hierarchy This Package Previous Next Index