Why doesn't this work?

I have created a GLCanvas with various patterns of red and blue all over it. Purely as an exercise I attempted to read a square of pixels from a position which I chose to be 0, 100. And the width and height of the square are 100. I then cleared the canvas to white (that part worked) and drew the saved square into a different location on the canvas (which I chose to be 0, 200). The result was that I ended up with a white background (as expected) and the black square (at the correct size of 100, 100) and at the correct location of 0, 200. The square came out at the right position and size but it should not have been black - it should have contained whatever colours were at the original location before the screen clear. Any code that could make this method do what I want would be highly appreciated.

Sorry about the poor indentation as it got messed up somewhere in translation from one machine to another.

Regards,

Sally.

    // test method which should move a square of 100 * 100 pixels to a different location
    public void movedisplay(GLDrawable drawable)
    {
// the canvas contains various colours (no black in there)     
GL gl = drawable.getGL();
      byte[] pixels = new byte[30000];  // 100 * 100 * 3 bytes (using square of 100 by 100 pixels and assuming 24 bit colour (3 bytes))

      gl.glReadPixels(0,100, 100, 100, GL.GL_COLOR_INDEX, GL.GL_BYTE, pixels);

      // clear the canvas to white
      gl.glClearColor( 1.0f, 1.1f, 1.0f, 1.0f ); //white
      gl.glClear (GL.GL_COLOR_BUFFER_BIT);

      // set new raster pos in different location
      gl.glRasterPos2d(0,200);

      // draw the original 100 x 100 square in this new raster location
      gl.glDrawPixels(100,100, GL.GL_COLOR_INDEX, GL.GL_BYTE, pixels);
    }