GLCanvas on an Applet, how to set size and location ??

Hello!

I am working with GLCanvas on an Applet.
Applet i have has a size on HTML x=100% y=100%

now, how to set my GLCanvas on (0,0) coordinates and a size of -> “w=AppletHeight*6/5” and “h=AppletHeight” ??
currently my code has imagine applet height 500, still i need to use my .html size 100% on my final code, how to resolve ??
if i try to use “this.getSize().height” i only receive a zero ???

my code follows ->


.....class extends to applet....

public void init()
    {
        setLayout(null);
        Dimension dim = new Dimension ();
        dim = this.getSize ();

        GLCanvas canvas = new GLCanvas();
        canvas.addGLEventListener(new Gears());
        canvas.setLocation(0,0);
        canvas.setSize(500*6/5,500);  // this is working just fine, but my applet height is 100% on html, not 500px ??
        canvas.setSize( dim.getHeight()*6/5,dim.getHeight() );  // why is this line not working at all, i only receive 0,0 size canvas ??
        add ( canvas );

        animator = new FPSAnimator(canvas, 60);
    }

//----

Thanks,

Try and move

        canvas.setSize(500*6/5,500);  // this is working just fine, but my applet height is 100% on html, not 500px ??
        canvas.setSize( dim.getHeight()*6/5,dim.getHeight() );  // why is this line not working at all, i only receive 0,0 size canvas ??

into resize() and add an attribute for canvas.

public void resize(Dimension dim)
{
        canvas.setSize(500*6/5,500);  // this is working just fine, but my applet height is 100% on html, not 500px ??
        canvas.setSize( dim.getHeight()*6/5,dim.getHeight() );  // why is this line not working at all, i only receive 0,0 size canvas ??}
}