public void paint(Graphics g)
    {
        //
        // Get the size of the applet
        //
        Dimension d = getSize();
        int width = d.width;
        int height = d.height - 30;

        //
        // Paint the applet's background
        // a random colour before drawing
        // the shape.
        //
        Color c = randomColor();
        g.setColor(c);
        g.fillRect(0, 0, width - 1, height - 1);

        //
        // Set our drawing colour
        //
        g.setColor(Color.black);

        //
        // Figure out the offset of the
        // shape from the edge of the applet.
        //
        int xOffset = width/20;
        int yOffset = height/20;

        //
        // Work out which shape to draw
        //
        double rand = Math.random();

        int shape = (int)(rand * 5);

        switch (shape)
        {
            case 0:
            {
                g.drawRect(xOffset,
                        yOffset,
                        width - (xOffset * 2),
                        height - (yOffset * 2));

                break;
            }
            case 1:
            {
                g.drawRoundRect(xOffset,
                        yOffset,
                        width - (xOffset * 2),
                        height - (yOffset * 2),
                        xOffset * 4,
                        yOffset * 4);

                break;
            }
            case 2:
            {
                g.drawLine(xOffset,
                        yOffset,
                        width - (xOffset * 2),
                        height - (yOffset * 2));
                break;
            }
            case 3:
            {
                g.drawOval(xOffset,
                        yOffset,
                        width - (xOffset * 2),
                        height - (yOffset * 2));
                break;
            }
            case 4:
            {
                g.drawArc(xOffset,
                        yOffset,
                        width - (xOffset * 2),
                        height - (yOffset * 2),
                        0,
                        120);
                break;
            }
            case 5:
            {
                g.draw3DRect(xOffset,
                        yOffset,
                        width - (xOffset * 2),
                        height - (yOffset * 2),
                        false);
                break;
            }
        }
    }