/** Clear the current cells and replace with the indicated starting pattern. */ public void reset(String patternName) { stop = true; int temp = generationMax; setGenerationCount(0); setMaxGenerations(0); if (patternName.equals("Random")) { theModel.reset(0.5); } else if (patternName.equals("R-Pentamino")) { theModel.reset(1); } else if (patternName.equals("Box")) { theModel.reset(2); } else if (patternName.equals("X Box")) { theModel.reset(3); } canvas.repaint(); // runGenerations(); //* Replace this by appropriate use of a thread synchronized (canvas) { canvas.notifyAll(); stop = false; canvas.repaint(); } setMaxGenerations(temp); setGenerationCount(0); }