What cause a GLJPanel reinit ?

Hello all !

I’m trying to display some swing panels over my GLJPanel. I call them Flying Panels and they are simply added into a null LayoutManager. Everything is ok for that I enjoy this JOGL feature.
My problem happens when I manipulate some controls into these panels, for example making a list visible with setVisible. Before setVisible has finished the GLJPanel is reinit (the init() method is called). I assume some Swing method which update the ui call this unnecessary reinit ? Could you explain me how this work ?

Thanks a lot

When using a GLJPanel, GLEventListener.init() may be called in response to addNotify / removeNotify or certain resizing events. The GLCanvas also calls init() due to addNotify / removeNotify, but not due to resizing events, due to fundamental differences in how the two components work. To figure out exactly what is going on, you could try subclassing GLJPanel and overriding addNotify / removeNotify to see whether they’re being called in your situation.

Thanks for your answer I didn’t know anything about addNotify.

I tried to subclass GLJPanel and addNotify and removeNotify methods. They are indeed called when I init for the fist time the panel or when I change perspective but unfortunately they aren’t called in the situation I described first. What else could call these inits ?

GLJPanel.reshape() can also (lazily) trigger a re-init.