How to draw using glBegin and glEnd

What object has the two methods glBegin and glEnd in JOGL2? I’ve found lots of examples that are done in the way I’ve written below, but I can’t get this to work. Have the objects for this changed from JOGL 1.1.1 to JOGL 2?

The compiler says :
The method glBegin(int) is undefined for the type GL


public boolean drawSelf(GLAutoDrawable glad)
{
	GL gl = glad.getGL();

        gl.glBegin(GL.GL_QUADS);  // <-- error

....

}

What am I doing wrong?

Thanks
Mossen

The code looks right to me. Off the top of my head I’m wondering if you are you remembering to import the GL class?

Can you post the entire compile error?

With JOGL2 it should be

GL2 gl = drawable.getGL().getGL2();
gl.glBegin(GL2.GL_QUADS); 

(The background is that with JOGL2 you can now select the OpenGL profile)
(and I think you want GL2 because you want glBegin)

Regards,
Fancy

Thanks Fancy, that was it!