init() GLEventListener method not getting called...

Hello,

I have a problem in that when I try to add a GLCanvas to my class (which extends JPanel) the init method is never called. Here is the code that’s adding the GLCanvas

GLCapabilities capabilities = new GLCapabilities();
		capabilities.setHardwareAccelerated(true);
		capabilities.setDoubleBuffered(true);
		
		canvas = GLDrawableFactory.getFactory().createGLCanvas(capabilities);
		canvas.addGLEventListener(this);
		
		this.add(canvas);
		Component[] comps = this.getComponents();
		for (int i=0; i<comps.length; i++)
			if (comps[i] == canvas)
				System.out.println("yeah");
		canvas.setVisible(true);
		canvas.setSize(parent.getWidth(),parent.getHeight());
		System.out.println("yo");

as you can see, I am checking to make sure that the GLCanvas is in fact added, and when I run the program “yeah” is printed, so the GLCanvas is definitely added. However, init() is never called. I was under the impression that this method was to be called either when the GLCanvas is first created or when it is added to something (I’m pretty sure I recall it being the latter). Is there any reason why init() wouldn’t be called with this set up?

Thanks

It doesn’t look like your top-level frame is being made visible. Until it is, the underlying wodget for the GLCanvas will not be created and therefore your init() callback won’t be called.