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
-
DRAW
-
-
history
- List to show move history.
-
moveLimit
- Number of moves before next timeslize.
-
rsetButton
- The reset-button.
-
timers
- These are the timers for black and white.
-
top
- The panel holding timers and reset-button.
-
VICTORY
-
-
CtrlPanel(ChessCtrlCallback, int, int)
- Creates new controls.
-
addMove(int, StringBuffer)
- This adds a half-move to historylist.
-
addShare(int, int)
- Adds a timeshare to given player if he has reached given
movecount.
-
getTimes()
-
-
initBottom()
-
-
initTop(ChessCtrlCallback, int)
- This initializes the top-panel.
-
killAll()
- Kills timers.
-
noOfMoves(int)
- Finds out number of made moves.
-
pause()
- Pauses both timers.
-
resetAll()
- Resets the control information.
-
resumeTimer(int)
- Resumes the timer for specified side.
-
setFont(Font)
- We don't allow to change font in historylists.
-
setMoveLimit(int)
-
-
unpause(int)
- This unpauses the timers.
history
private List history[]
- List to show move history.
DRAW
public static final String DRAW
VICTORY
public static final String VICTORY
top
private Panel top
- The panel holding timers and reset-button.
timers
private ChessTimer timers[]
- These are the timers for black and white. The indexies are same
as in Piece-class.
moveLimit
private int moveLimit
- Number of moves before next timeslize.
rsetButton
private Button rsetButton
- The reset-button.
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.
initBottom
private Panel initBottom()
setMoveLimit
private void setMoveLimit(int moves)
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.
resetAll
void resetAll()
- Resets the control information.
killAll
public void killAll()
- Kills timers. Possibly current thread last.
pause
void pause()
- Pauses both timers. This has one rather nasty feature: according to
netscape, calling Thread.suspend() might result navigator deadlock.
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.
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.
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.
noOfMoves
int noOfMoves(int side)
- Finds out number of made moves.
- Parameters:
- side - Side whose movecount we want.
- Returns:
- Number of made moves.
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
getTimes
public int[] getTimes()
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