17 package org.bitstorm.gameoflife;
19 import java.applet.Applet;
20 import java.awt.Color;
21 import java.awt.GridBagConstraints;
22 import java.awt.GridBagLayout;
47 setBackground(
new Color(0x999999));
51 gameOfLifeGrid.
clear();
61 GridBagLayout gridbag =
new GridBagLayout();
63 GridBagConstraints canvasContraints =
new GridBagConstraints();
65 canvasContraints.fill = GridBagConstraints.BOTH;
66 canvasContraints.gridx = GridBagConstraints.REMAINDER;
67 canvasContraints.gridy = 0;
68 canvasContraints.weightx = 1;
69 canvasContraints.weighty = 1;
70 canvasContraints.anchor = GridBagConstraints.CENTER;
71 gridbag.setConstraints(gameOfLifeCanvas, canvasContraints);
72 add(gameOfLifeCanvas);
74 GridBagConstraints controlsContraints =
new GridBagConstraints();
75 canvasContraints.gridy = 1;
76 canvasContraints.gridx = 0;
77 controlsContraints.gridx = GridBagConstraints.REMAINDER;
78 gridbag.setConstraints(controls, controlsContraints);
111 param = getParameter( name );
113 paramInt = defaultParam;
115 paramInt = Integer.valueOf(param).intValue();
125 if (gameThread == null) {
126 gameThread =
new Thread(
this);
142 public synchronized void run() {
143 while (gameThread != null) {
146 Thread.sleep(genTime);
147 }
catch (InterruptedException e) {
158 return gameThread != null;
165 gameOfLifeGrid.
next();
166 gameOfLifeCanvas.repaint();
182 alert( e.getMessage() );
191 gameOfLifeCanvas.repaint();
200 return "Game Of Life v. 1.5\nCopyright 1996-2004 Edwin Martin";
synchronized void start2()
GameOfLifeGrid gameOfLifeGrid
GameOfLifeControls controls
int getParamInteger(String name, int defaultParam)
void speedChanged(GameOfLifeControlsEvent e)
synchronized void setShape(Shape shape)
void shapeSelected(GameOfLifeControlsEvent e)
static Shape getShapeByName(String name)
CellGridCanvas gameOfLifeCanvas
synchronized void clear()
void setGeneration(int generations)
void nextButtonClicked(GameOfLifeControlsEvent e)
void zoomChanged(GameOfLifeControlsEvent e)
void setShape(Shape shape)
void setCellSize(int cellSize)
void addGameOfLifeControlsListener(GameOfLifeControlsListener listener)
void startStopButtonClicked(GameOfLifeControlsEvent e)