JAVA JMenuitem is overrided by an OpenGl object


I have inserted my OpenGl GLAnimCanvas object in a Java interface. This interface has a menu like “file”… “Edit”… it’s a MenuBar object.

When I open the menu with a big number of item, it is in contact with the opengl object.

The problem is that the opengl object hides the menu. The menu is behind the opengl object and the user can no more choose what he wants…

Do you know where the poblem could come from

Thanks a lot

It is a conflict between heavy and lightwieght surfaces. You glcanvas is heavyweight and will always draw on top. Your menu is lightweight and will always be drawn over by the heavyweight canvas. There is a static call that makes menus heavyweight. I think it is along the lines of menu.setdefaultlightweight( false ). You might want to check out for quicker help. There is an article on Sun’s website that explains heavy/light weight better than I can.


I will try to find what I can… I know where it comes from now.


it seems that I have to use a swing component… because GLAnimCanvas is a AWT component… and that what makes it heavy…