JTree reflects JTabbedPane
Hi,
I have a JTree which has a TreeSelectionListener listening to it, when i click on a node of the JTree it opens a tab in the Tabbed pane...
publicvoid valueChanged(TreeSelectionEvent e){
JTree sourceTree = (JTree) e.getSource();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) sourceTree.getLastSelectedPathComponent();
if (node ==null)return;
Object nodeInfo = node.getUserObject();
String[] criteria =null;
if (node.isLeaf()){
String transName = (String) nodeInfo;
if(!tabList.contains(transName)){
tabList.add(transName);
criteria = selectCriteria(transName);
tabbedPane.addTab(transName, null, criteria);
}
util.updateStatusBar(transName);
}
}
Now what i would like to do is, when the user has opened the tabs, and then clicks on a node the pertaining tab in the Tabbedpane should comealive.
Is there a way to get a tab in the tabbed pane into focus?
I have the tabbedPane object with me so i figure there should be a way to get this done...
Any pointers would be welcome.
Thank You!!
-Uday

