Swing Canvas issue

I’ve adapted the Swing Canvas example https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:swing_canvas to put the canvas in a JTabbedPane. Unfortunately, it doesn’t seem to render correctly.

You can see that the canvas is obscuring the tab buttons rather than being rendered inside the tab. This is on OSX Lion 10.7.5 with a Radeon HD5770 1024 MB card.

Nick

Looks like this might be a LWJGL issue:
http://lwjgl.org/forum/index.php/topic,4985.0.html

I upgraded to Java 1.7.0_45 and that solved the offset problem. The JME canvas now draws within the tab. However, it always remains at the forefront. The canvas is on the first tab and when I switch to the second tab the canvas remains visible, obscuring what’s in the second tab.

Nick

Might be LWJGL canvas not properly responding to being obscured.
You could try placing some Swing widget (JPanel recommended, less optimizations that might interfere) in the glass pane of the top-level window. The glass pane is always in front of the normal stuff, so the JPanel should remain visible no matter what; if the canvas overdraws it, they did something wrong.

Didn’t we go through this? Use AwtPanels.

Yes, that’s what I’m using. Seems to work well except for the native unpacking issue that I mention at:

http://hub.jmonkeyengine.org/forum/topic/awtpanelscontext-doesnt-extract-natives/

thanks for your help,

Nick