Java 3d viewer and internal frames

I have followed the java base examples to create a 3d viewer in java. When this viewer is used inside a Frame or JFrame this works fine. However when I try to put the same JPanel inside a JInternalFrame I get some strange behaviour. Initially the viewer is displayed, but when the frame is moved the viewer diappears and is replaced by a grey background. Additionally, my JMenubar will not display above the viewer. Does anybody know why this is happening so that I can find a fix? Occasionally, I get some error with wglMakeCurrent - error code 6.

I think this is an important issue for people trying to write CAD-type applications which want to display 3d views with other frames for buttons, text windows etc. So I hope somebody can help?

Thanks,

David G Bramall

i-fontaine's picture

It's currently impossible to render OpenGL within a JInternalFrame. The OpenGL is in fact rendered in a Canvas (AWT Heavyweight) which cannot be located within a JInternalFrame. It's the same for Java3d. It's a bug, or at least an architectural weakness of Java. It's not an opencascade problem. Just cross your fingers and hope Sun fix it.... You can "vote" for this bug at the "Bug Parade" at http://java.sun.com . But it seems they're still counting the votes :-). No other useable solution to this problem. Here we use JSplitpanes.

For the menu you must make the following call: JPopupMenu.setDefaultLightWeightPopupEnabled(false); It will allow to display the menus on top of the OpenGL Canvas.

Ivan Fontaine.