super(false); //XXX Maybe should double buffer?
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
Font rowTitleFont = new Font("serif", Font.BOLD, 14);
Font ballFont = new Font("serif", Font.PLAIN, 12);
Font bigFont = new Font("serif", Font.BOLD, 36);
GridLayout g;
allBallsPane = new JPanel(false);
g = new GridLayout(Card.SIZE, BingoBall.RANGE + 1);
g.setHgap(5);
g.setVgap(5);
allBallsPane.setBorder(BorderFactory.createLoweredBevelBorder());
allBallsPane.setLayout(g);
allBallsPane.setBackground(Color.darkGray);
for (int i = 0; i < Card.SIZE; i++) {
for (int j = 0; j < BingoBall.RANGE; j++) {
if (j == 0) {
rowTitles[i] = new JLabel(new Character(Card.columnTitles[i]).toString(), JLabel.CENTER);
rowTitles[i].setFont(rowTitleFont);
rowTitles[i].setForeground(litColor);
allBallsPane.add(rowTitles[i]);
}
allBalls[i][j] = new JLabel(new Integer((j+1)+(i*BingoBall.RANGE)).toString(), JLabel.CENTER);
allBalls[i][j].setFont(ballFont);
allBallsPane.add(allBalls[i][j]);
}
}
newBallPane = new JPanel(false);
newBallPane.setLayout(new GridLayout(1, 1));
newBallLabel = new JLabel("Waiting...", JLabel.CENTER);
newBallLabel.setFont(bigFont);
newBallPane.setBorder(BorderFactory.createLoweredBevelBorder());
newBallPane.add(newBallLabel);
newBallPane.setMinimumSize(newBallPane.getPreferredSize());
newBallPane.setPreferredSize(newBallPane.getPreferredSize());
add(newBallPane);
add(allBallsPane);