Login  Register

Repaint on switch from GLCanvas to Swing

Posted by karelknoes on Nov 22, 2013; 1:02pm
URL: https://forum.jogamp.org/Repaint-on-switch-from-GLCanvas-to-Swing-tp4030675.html

Dear all,

Our application switches between a GLCanvas to offer a 3D view and a several Swing JPanels to offer a various 2D views. For convenient switching, we use a CardLayout.

We experience a problem with the painting of the Swing views when switching from GLCanvas to Swing. Directly after the GLCanvas is interchanged for a Swing JPanel, the Swing JPanel shows a flash of garbage (one frame) before drawing its proper content. Crudely put, it seems Swing realizes too late that a repaint is required.

If we replace heavyweight GLCanvas with lightweight GLJPanel, then this refresh problem doesn't occur.

Looking forward to any thoughts that might help to find a solution.