Add a Component to two different JTabbedPanes
- by haldean
I have a LinkedList of Components, each of which I would like to add into two different JTabbedPanes. For some reason, Swing is only letting me put each component into one or the other. The code I'm using is the following:
/* The two tab panes */
JTabbedPane leftTabs = new JTabbedPane();
JTabbedPane rightTabs = new JTabbedPane();
for (int i=0; i<tabPanes.size(); i++) {
rightTabs.add(tabPanes.get(i));
leftTabs.add(tabPanes.get(i));
}
Whichever add call I put last is the one that works; if I add to leftTabs last, then rightTabs ends up empty, and vice-versa.
Any ideas on how to get this working? Thanks!