I have a feeling that the problem with swapping out components of a JSplitPane has something to do w/ the GLCanvas that is contained within the JTabbedPane of the top component of a JSplitPane.
I have two JSplitPanes, splitA has a left and right side, and splitB is
contained in the right pane of splitA. splitB has a top and bottom
component. Sorta looks like this …
±----------+
| | top |
- |-------+
| | bot |
±----------+
(l) ®
splitA = left and right
splitB = top and bottom (contained within right)
When calling JSplitPane.setTopComponent() on splitB from a JTabbedPane
to a simple JPanel, it works very smoothly and changes the top
component out correctly. But when I call setTopComponent again and put
my JTabbedPane back in (which btw hold a JPanel w/ the GLCanvas inside it), the entire window of my app blinks, both SplitPanes flash, even though I’m only calling setTopComponent of the inner splitPane (splitB). It doesn’t
change out smoothly like the first call did with just a simple JPanel.
I don’t think it’s anything wrong with the glCanvas, but I have an idea it might be the way I’m using it. I make the calls like this.
public class MyTreeSelectionListener implements TreeSelectionListener
{
public void valueChanged(TreeSelectionEvent tse) {
...
setComponentView(info);
}
public void setComponentView(MyInfo info) {
if (myApp.rightSplitPane.getTopComponent().toString().contains(
"JTabbedPane")) {
if (info.getType() == PANEL_A) {
myApp.rightSplitPane.setTopComponent(myApp.panelA);
}
}
else {
if (info.getType() != PANEL_A) {
myApp.rightSplitPane.setTopComponent(myApp.tabbedPane);
}
}
return;
}
}
myApp.tabbedPane is a JTabbedPane() component built like this:
glPanel = new JPanel(new BorderLayout());
GLCapabilities caps = new GLCapabilities();
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
glCanvas = GLDrawableFactory.getFactory().createGLCanvas(caps);
...
glCanvas.addGLEventListener(glRenderer);
glPanel.add(glCanvas, BorderLayout.CENTER);
tabbedPane = new JTabbedPane();
tabbedPane.addTab("tab1" , glPanel);
tabbedPane.addChangeListener(this);
Just wondering if someone might pickup on what’s going on here better. Any help much appreciated.