Using JOGL in a Swing program

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

Using JOGL in a Swing program

tomd
I am trying to use GLCanvas in a Swing program. Specifically the GLPanel is embedded in a JPanel containing toolbars, menus etc.

Basically works OK, except that drop down elements from the Swing toolbars which overlap the GLPanel don't display. If a dropdown partly overlaps the GLPanel, the bits which don't overlap display OK.

I am not an AWT programmer, I have heard there are problems mixing AWT and Swing. Or maybe it is the fact that the GLPanel is continuously repainting? Can anyone offer any insights?

Incidentally, comboboxes seem to work OK. I am using the JideSoft framework, which reimpliments many standard items such as menus using JPanels, and it is these items which don't seem to work.
Reply | Threaded
Open this post in threaded view
|

Re: Using JOGL in a Swing program

ariekenb
GLCanvas is heavyweight. GLJPanel is lightweight, as are JPanel, JMenu, etc.

In older versions of Java there were problems putting lightweight components over heavyweight - the heavyweight component would always show through.  This has fairly recently been fixed in AWT so that putting lightweight over heavyweight mostly works well now.  See this article for more information: http://java.sun.com/developer/technicalArticles/GUI/mixing_components/index.html

According to the article the improvements went into 6u12 so make sure you are using at least that version.
Reply | Threaded
Open this post in threaded view
|

Re: Using JOGL in a Swing program

tomd
I have looked at the article, I am trying to figure out where to revalidate in my code (I am using a recent Java, but it isn't working properly).

What about GLJPanel? Is it reliable?