tags:

views:

291

answers:

1

I apologize if this question is too basic, but I just can't figure out how to do this. I have a SWT TableFolder with two tabs, and I need to determine which of those two tabs are currently active, as it effects the behavior of another part of the program. Is this possible? Thank you in advance.

+1  A: 

To you mean the org.eclipse.swt.widgets.TabFolder (CTabFolder)?

If yes add an eventlistener to your TabFolder(CTabFolder object

tabFolder.addSelectionListener(new SelectionAdapter() {
  public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
    tabFolder.getSelection()[0]; // This should be your TabItem/CTabItem
  }
});

If you simply have a javax.swing.JTabbedPane then calling

yourJTabbedPaneVariableName.getSelectedIndex()

gives you the index of the selected Tab

jitter
Thank you very much, that getSelection() is exactly what I needed, I don't know how I missed that.
Igman