JMenuBar menu's are hidden by OpenGL canvas

Started by Dominic2, January 22, 2009, 08:32:03 PM

Previous topic - Next topic

Dominic2

Hi,

I'm trying to put a JMenuBar in my application window. The menu bar itself is displayed correctly. Unfortunatly, the menus that appear when the user click on a menu of the menu bar are hidden by the OpenGL canvas in the window. The canvas is always rendered on top of the menus.

I use the OpenGL renderer only. I use

frameBuffer.enableGLCanvasRenderer(IRenderer.MODE_OPENGL);

to initialise the OpenGL renderer and then I disable the software renderer. When rendering, I use the following code :

        frameBuffer.clear();
        world.renderScene(frameBuffer);
        world.draw(frameBuffer);
        frameBuffer.update();
        frameBuffer.display(graphics);
        canvas.repaint();


Is there something I can change to allow the menu to be displayed correctly ?

Thank you for your help.

EgonOlsen

The  GL-canvas is a heavy-weight component. Might be that the menu is light-weight...i'm not a Swing-guy, but i think it is. IIRC, there is some way to force light-weight components to be heavy-weight. Maybe the lwjgl-forum at http://lwjgl.org has some more info about this issue.


paulscode

I had the same issue a while back, but never found a desireable solution (I kept having flicker issues).  If you ever figure this out, let me know.

Dominic2

I found a solution. Swing purists are not going to like it, but it works for me. I use Menu (from awt) instead of JMenu (from swing). Menu use the OS's menu bar and this one isn't displayed under the 3D view.

influt

you could also try
JPopupMenu.setDefaultLightWeightPopupEnabled(aFlag)
but it works only for popups, other swing components won't display over the GL window correctly

paulscode

Yeh, I was more interested in other Swing components than the JMenu.  It is good to know that at least Menu will work, though.