I have used two tabFolders tabFolder_1 and tabFolder_2 . Each tabFolders have two tabItems tabItem_1,tabItem_2 in tabFolder_1 and tabItem_3 and tabItem_4 in tabFolder_2. Now what i'm trying to do is when i select the fir开发者_运维技巧st Tabitem tabItem_1 of tabFolder_1 i want the tabItem tabItem_3 to be selected in tabFolder_2 and similarly when i select tabItem_2 in tabFolder_1 i want the tabItem tabItem_4 to be selected . I have been able to do this using button and writing the code" tabFolder_2.setSelection(1);" in the widgetSelectedEvent of the button . How can i do this simply by clicking on the tabItem ?
You can add listener to see which tabFolder is selected, and than based on that information call function that sets active tabs.
For example you can see which tab is selected with folowing code
tabFolder_1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
System.out.println(tabFolder_1.getSelection()[0].getText() + " is selected");
}
});
精彩评论