//------------// Introduction to Programming Using Java: An Object-Oriented Approach//	Arnow/Weiss//------------import java.awt.*;import java.awt.event.*;import java.applet.*;class LifeDisplay extends Canvas {    LifeDisplay() {        setBackground(new Color(0,210,90));    }    void displayWorld(boolean [][] world) {        this.world = world;        Graphics g = this.getGraphics();        paintBackground(g);        paintWorld(g);    }    public void update(Graphics g) {        paintBorder(g);        paintBackground(g);        paintWorld(g);    }    private void paintBackground(Graphics g) {        g.setColor(new Color(240,210,0));        g.fillRect(5,5,this.getSize().                       width-10,this.getSize().height-10);    }    private void paintBorder(Graphics g) {        g.setColor(new Color(0,0,0));        g.fillRect(0,0,this.getSize().width,5);        g.fillRect(0,this.getSize().                       height-5,this.getSize().width,5);        g.fillRect(0,0,5,this.getSize().height);        g.fillRect(this.getSize().                       width-5,0,5,this.getSize().height);    }    private void paintWorld(Graphics g) {        g.setColor(new Color(30,20,120));        if (world != null)           for (int i = 0; i < world.length; i++)               for (int j = 0; j < world[i].length; j++)                   paint1Square(g,i,j);    }    private void paint1Square(Graphics g, int i, int j) {        if (world[i][j])           g.fillRect(5+i*CellWidth, 5+j*CellWidth,                       CellWidth, CellWidth);    }    boolean[][]        world = null;    static final int   CellWidth = 3;}