All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class kpalin.alabra.CtrlPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----kpalin.alabra.CtrlPanel

public class CtrlPanel
extends Panel
Other major panel on the screen. Contains timers, reset and historylist.

Author:
Kimmo Palin

Variable Index

 o DRAW
 o history
List to show move history.
 o moveLimit
Number of moves before next timeslize.
 o rsetButton
The reset-button.
 o timers
These are the timers for black and white.
 o top
The panel holding timers and reset-button.
 o VICTORY

Constructor Index

 o CtrlPanel(ChessCtrlCallback, int, int)
Creates new controls.

Method Index

 o addMove(int, StringBuffer)
This adds a half-move to historylist.
 o addShare(int, int)
Adds a timeshare to given player if he has reached given movecount.
 o getTimes()
 o initBottom()
 o initTop(ChessCtrlCallback, int)
This initializes the top-panel.
 o killAll()
Kills timers.
 o noOfMoves(int)
Finds out number of made moves.
 o pause()
Pauses both timers.
 o resetAll()
Resets the control information.
 o resumeTimer(int)
Resumes the timer for specified side.
 o setFont(Font)
We don't allow to change font in historylists.
 o setMoveLimit(int)
 o unpause(int)
This unpauses the timers.

Variables

 o history
 private List history[]
List to show move history.

 o DRAW
 public static final String DRAW
 o VICTORY
 public static final String VICTORY
 o top
 private Panel top
The panel holding timers and reset-button.

 o timers
 private ChessTimer timers[]
These are the timers for black and white. The indexies are same as in Piece-class.

 o moveLimit
 private int moveLimit
Number of moves before next timeslize.

 o rsetButton
 private Button rsetButton
The reset-button.

Constructors

 o CtrlPanel
 CtrlPanel(ChessCtrlCallback blisten,
           int moves,
           int timeShare)
Creates new controls.

Parameters:
blisten - Listener for button action.
moves - Number of moves in timeShare
timeShare - Time in which must moves be made.

Methods

 o initBottom
 private Panel initBottom()
 o setMoveLimit
 private void setMoveLimit(int moves)
 o addShare
 private void addShare(int side,
                       int count)
Adds a timeshare to given player if he has reached given movecount.

Parameters:
side - Side of the player.
count - Number of moves player has made.
 o resetAll
 void resetAll()
Resets the control information.

 o killAll
 public void killAll()
Kills timers. Possibly current thread last.

 o pause
 void pause()
Pauses both timers. This has one rather nasty feature: according to netscape, calling Thread.suspend() might result navigator deadlock.

 o unpause
 void unpause(int who)
This unpauses the timers. Resumes them only if there has been recorded moves.

Parameters:
who - Side whose turn it is.
 o resumeTimer
 void resumeTimer(int side)
Resumes the timer for specified side. Stops the other players timer. This has one rather nasty feature: according to netscape, calling Thread.suspend() might result navigator deadlock.

Parameters:
side - Side whose timer is to be resumed.
 o addMove
 void addMove(int side,
              StringBuffer strb)
This adds a half-move to historylist.

Parameters:
side - The movers side (Piece.WHITE,Piece.BLACK)
strb - String representation of the move.
 o noOfMoves
 int noOfMoves(int side)
Finds out number of made moves.

Parameters:
side - Side whose movecount we want.
Returns:
Number of made moves.
 o initTop
 private Panel initTop(ChessCtrlCallback blisten,
                       int timeShare)
This initializes the top-panel. This is just to clean up the constructor.

Parameters:
blisten - Button listener
 o getTimes
 public int[] getTimes()
 o setFont
 public void setFont(Font f)
We don't allow to change font in historylists.

Overrides:
setFont in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index