Place an openGL canvas into JInternalFrame?

Hello, I am very new to JAVA and unfamiliar with the JOGL bindings. I am trying to place some openGL code that I have written into a swing JIntenalFrame, that is contained in a JDesktopPane. I created a canvas using the following code:

GLCapabilities glcaps = new GLCapabilities();
GLCanvas mycanvas = GLDrawableFactory.getFactory().createGLCanvas(glcaps);

mycanvas.addGLEventListener(new myclassEventListener());

jInternalFrame.getContentPane().add(mycanvas, java.awt.BorderLayout.CENTER);

THis seems to work, I see the openGL canvas in the frame, but there are some big time bugs. Whenever I move the frame, the drawings dissapear, then reappear at random. Also there are more internal frames on the desktop pane than just the one that contains openGL. Whenever I move any of these over top of the openGL frame, or maximize. The internal frame (I.E. borders) containing the canvas moves behind the other frame, but the canvas stays on top. Regardless of where the frame is layered, the GL canvas always remains on top. Can anyone help me fix this problem, or is it an inherrant problem with JOGL?

The GLCanvas is a heavyweight component and therefore obscures all lightweight components. If you need complete compatibility with Swing you should use the GLJPanel component. See the JRefract demo in the jogl-demos workspace for an example of using JOGL inside a JInternalFrame.

You should also be sure to specify the system property -Dsun.java2d.noddraw=true for compatibility between Java2D and JOGL, and make sure you’re using the latest JOGL build (1.1 b10).

Thanks Ken, I did what you said, and it worked great. Except I didn’t really understand what you said about setting the system propertty, like I said I am new at JAVA and JOGL so I don’t have experience with setting system properties. I have downloaded the Demo and I will look into the source to see if there is anything else in there I might need to know. Maybe I’ll see something in there about the system property. Thanks again for the help.