Add a Component to two different JTabbedPanes

Posted by haldean on Stack Overflow See other posts from Stack Overflow or by haldean
Published on 2010-05-05T20:10:03Z Indexed on 2010/05/05 20:18 UTC
Read the original article Hit count: 125

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about java

Related posts about swing