import java.awt.*; import javax.swing.*; public class Life extends JApplet { int rows, cols; public void init() { String input; input = JOptionPane.showInputDialog("Enter # of rows","20"); rows = Integer.parseInt(input); input = JOptionPane.showInputDialog("Enter # of columns","20"); cols = Integer.parseInt(input); } public void paint(Graphics g) { super.paint(g); char [][] world = new char[rows][cols]; world[5][5]='*'; world[6][5]='*'; world[7][5]='*'; world[7][6]='*'; world[7][7]='*'; world[6][7]='*'; world[5][7]='*'; int nbors; do { g.setColor(Color.WHITE); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(Color.BLACK); for (int i=1; i