import java.awt.*;
/**
* Title: GameBoard<p>
* Description: The gameboard panel displays the playing area for
* Pancet, a game applet. It is divided into four sections, each
* one displaying the image of a bowl containing zero to eight balls.
* The contents of the bowls is represented by subsituting bowl images.<p>
*
* Copyright: Copyright (c) 2004<p>
*
* @author Mark Bondurant
* @version 3.0
*/
class GameBoard extends Panel implements GameConstants {
private BowlCanvas bowlCanvas[];
/**
* This sets up the initial game board showing four empty
* bowls.
*/
GameBoard(Image bowl0) {
bowlCanvas = new BowlCanvas[4];
setLayout(new GridLayout(2, 2));
setFont(new Font("Helvetica", Font.BOLD, 12));
setBackground(Color.white);
bowlCanvas[0] = new BowlCanvas(bowlName[0], bowl0,
bowlLabelLocation[0][0], bowlLabelLocation[0][1]);
add(bowlCanvas[0]);
bowlCanvas[1] = new BowlCanvas(bowlName[1], bowl0,
bowlLabelLocation[1][0], bowlLabelLocation[1][1]);
add(bowlCanvas[1]);
bowlCanvas[3] = new BowlCanvas(bowlName[3], bowl0,
bowlLabelLocation[3][0], bowlLabelLocation[3][1]);
add(bowlCanvas[3]);
bowlCanvas[2] = new BowlCanvas(bowlName[2], bowl0,
bowlLabelLocation[2][0], bowlLabelLocation[2][1]);
add(bowlCanvas[2]);
}
synchronized void setImage(int bowl, Image b) {
bowlCanvas[bowl].setImage(b);
}
}