glCanvas cutting Menubar Dropwindow (Screenshot included)

The problem is simple, the solution unknown…

My glCanvas(Inside is a jME Szene) is cutting off my Dropwindow.

The menubar should be in the foreground! Exist there any Solution?


This is because you are mixing lightweight and heavyweight swing components. The canvas is heavyweight and therefore the painting is controlled natively (by your OS). You menu is a lightweight component drawn by swing.

The solution is to tell swing to use a heavyweight component in place of the lightweight one for your menu popup.


Thanks!!! Worked!

Thought something like that, but I would have tried to repaint it every time(without success of course^^)

I had the same problem, but menu.setLightWeightPopupEnabled(false); did not solve my problem becose sometimes it was slow. Menu apears first like gray rectangle and menuItems are painted after a while…

I found this solution that works much better. I is static function that need to be called once on application initialization.

public static void heavyWeightWorkaround()
try {
// Due to the strange way PopupFactory is implemented, we need to
// use reflection to make sure
// we *really* get heavyweight popups from the very start.
Class popup = PopupFactory.class;
Field heavyweight = popup.getDeclaredField("HEAVY_WEIGHT_POPUP");
Method setPopupType =
popup.getDeclaredMethod("setPopupType", Integer.TYPE);
setPopupType.invoke(PopupFactory.getSharedInstance(), heavyweight
catch (Exception ex) {

Btw, I found this in source code of ArtOfIllusion ( )