JOGL Integration in Swing App

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL Integration in Swing App

3dcoder
Hi!

From my searching through the site I found mostly somewhat older posts about Swing integration, and I am not sure
whether these infos are still valid since Newt got that good in the meantime.

What is suggested way to integrate JOGL into a Swing Application? I am not using InternalFrames - just a simple
JFrame with JMenuBar and JPanels around a JPanel that contains a NewtCanvasAWT. Using this NewtCanvasAWT works
like a charm - besides some Z order problems with the Swing drop down menus.

My question now is: Is the proposed solution to change to AWT DropDownMenus? Or is there a workaround to correct the
Z order and keep the Swing DropDownMenus?

Both ways will a way to go for me - but I'd like to know the most official and supported way to do this.

Thanks!
Stefan
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Integration in Swing App

gouessej
Administrator
Hi

Try to call JPopupMenu.setDefaultLightWeightPopupEnabled(false);

Have you tried to use GLCanvas?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Integration in Swing App

3dcoder
This one did it:

> JPopupMenu.setDefaultLightWeightPopupEnabled(false);

Thanks a lot, Julien!

Using GLCanvas is no way to go for me - I am running an own 3D Engine and it is initialized by giving an EngineDisplaySettings
object. This object contains the info to run as Fullscreen, Windowed or paneled mode. Fullscreen and window mode use
GLWindow with Newt event handlers. The paneled mode would then use AWT Event listeners and this would give too much
"confusion" in the Engine code and its event handling code.

But thanks to your hint, I can now keep the nice Swing Menus. Yeah :)

Kind regards,
Stefan
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Integration in Swing App

gouessej
Administrator
You're welcome. I remind you that this information is in the user guide:
When using JPopupMenus or Swing tool tips in conjunction with the GLCanvas, it is necessary to disable the use of lightweight widgets for the popups. See the methods ToolTipManager.setLightWeightPopupEnabled, JPopupMenu.setLightWeightPopupEnabled, and JPopupMenu.setDefaultLightWeightPopupEnabled.
I thought it would be useful for NEWT too, I was right.
Julien Gouesse | Personal blog | Website