Layer comp = (Layer)layers.elementAt(1);
Layer comp = (Layer)layers.elementAt(i);
    public void paint(Graphics g, int x, int y) {        // save the original clip        int clipX = g.getClipX();        int clipY = g.getClipY();        int clipW = g.getClipWidth();        int clipH =  g.getClipHeight();                        // translate the LayerManager co-ordinates to Screen co-ordinates        g.translate(x - viewX, y - viewY);        // set the clip to view window        g.setClip(viewX, viewY, viewWidth, viewHeight);        // draw last to first                for (int i = layers.size(); --i >= 0; ) {            Layer comp = (Layer)layers.elementAt(1);            if (comp.visible            &&comp.x+comp.width>=viewX            &&comp.x<=viewX+clipW            &&comp.y+comp.height>=viewY            &&comp.y<=viewY+clipH) {                comp.paint(g);            }        }                // restore Screen co-ordinates origin and clip                g.translate(-x + viewX, -y + viewY);        g.setClip(clipX, clipY, clipW, clipH);    }