JMenu appearing below Jme Canvas in swing

so i went through the JMESwing test and have come opun a problem, When the JMenu is clicked on it goes underneath my JMe canvas, any ideas what im doing wrong or for a fix?

Yes there is a solution. And it's very simple. Don't use them.



As you know, JMEDesktop can only support JInternalFrame and lightweight components. The definition of JMenu is not very clear, but it's certainly not defined that it must be a JInternalFrame, so there's absolutly no garantuee this can ever work across different platforms and implementations. Sometimes it's even a heavy weight component (like on OSX). As much as we'd like to, there's no easy way to get that rendered somewhere other than where the OS decides it should be.

Oops…



Well that was stupid then.

Maybe not really relatet but i get this exception when trying to drop down the dropdown menue in TestJMEDesktop

this is on suse 10.0 (linux) btw.



03.01.2006 14:01:46 com.jmex.awt.swingui.JMEDesktop$MyPopupFactory getPopup

SCHWERWIEGEND: Popup creation failed - desktop not found in component hierarchy of javax.swing.JInternalFrame[,0,0,1024x768,invalid,layout=javax.swing.plaf.basic.BasicInternalFrameUI$Handler,alignmentX=0.0,alignmentY=0.0,border=,flags=16777472,maximumSize=,minimumSize=,preferredSize=,closable=false,defaultCloseOperation=DISPOSE_ON_CLOSE,desktopIcon=javax.swing.JInternalFrame$JDesktopIcon[,0,768,160x31,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@bcda2d,flags=8,maximumSize=,minimumSize=,preferredSize=],frameIcon=javax.swing.plaf.IconUIResource@67064,iconable=false,isClosed=false,isIcon=false,isMaximum=false,isSelected=false,maximizable=false,opened=true,resizable=false,rootPane=javax.swing.JRootPane[,0,0,1024x768,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=449,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,title=]

java.lang.reflect.InvocationTargetException

Hey! That's thread hijacking! :stuck_out_tongue:



I have fixed that, winkman.

JMECanvas is heavyweight.  You might try calling JPopupMenu.setDefaultLightWeightPopupEnabled(false); somewhere very early in your code to signal that you do not want lightweight popups (such as menus, etc.)

hey renanse thanks for answering i'll try that

yeah, llama im not using JMEDesktop i have a canvas which displays jme, but there is a JMenu attached to the frame that the canvas is in. When the JMenu is clicked it should appear above the canvas but instead appears behind it. Thanks though :slight_smile:

edit: thanks renanse that works, thanks perfectly  :smiley:

Good to hear!

drfugly said:

hey renanse thanks for answering i'll try that
yeah, llama im not using JMEDesktop i have a canvas which displays jme, but there is a JMenu attached to the frame that the canvas is in. When the JMenu is clicked it should appear above the canvas but instead appears behind it. Thanks though :)
edit: thanks renanse that works, thanks perfectly

Yeah, but then we'd have to read and find it amongst words and stuff.  :wink: