[java] OpenGL and Swing

Started by
3 comments, last by a2k 23 years, 5 months ago
i''m using the Magician binding, and it said somewheres in the documentation that it doesn''t fully work with Swing. Has anyone tried using Swing in their OpenGL apps/applets? a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
I have a little source code for a Magician based game engine that used Swing components (just a side project that I haven''t worked on in months). You basically have the same situation as any time you mix a heavy weight (GLComponent) and a light weight component. I believe there is an article on Javasoft.com on issues to watch when doing this.

I use absolute position for placing all of my components, so the heavy weight and light weight components never overlap.

If you all promise not to laugh hysterically at the trashy state of the code, I will post what little I have to the FAQ site this weekend (though I can''t say it will be of much use).
somelightweightcomponent.setLightWeightPopupEnabled( false );

Works just fine. All the apps on my site are swing. I even, finally, got japplets to work with magician.

I wanrned you! Didn't I warn you?! That colored chalk was forged by Lucifer himself!
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
okay, so help me clarify here. um, what are lightweight/heavyweight components? and how can i make them work with ogl/swing? i''m just allowed to use heavyweight components? is that it?

lightweight components are just like floatable stuffs, no?

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
I believe that lightweight components use the drawing facilities of the heavyweight components. For example JPopupMenu''s don''t automatically get their own painting methods. They will instead look to the JFrame or JApplet(heavyweights) that it is in to paint itself. I think they did this to speed things up and save some memory. The effect of this is if you have lightweight components in an enviornment that has non-swing components then the lightweight component may be drawn over. GLComponent is based on AWTCanvas. It is heavyweight and does not support lightweight swing components. It will draw over a lightweight component. Not all floating components are lightweight. Not all nonfloating components are heavyweight. By using the setLightWeightPopupEnabled( false ) for JPopupMenu''s you tell it that it needs to do its own repainting. This allows it to draw over a heavyweight component.

I wanrned you! Didn''t I warn you?! That colored chalk was forged by Lucifer himself!
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson

This topic is closed to new replies.

Advertisement