Find out what JTabbedPane tab is selected

Note:
1.Each Tab in a Tabbed Pane is a JPanel i.e it has a name
2.The first Tab index is ’0′, 2′nd tab ’1′ and so on.
3.’StateChanged’ event is fired on selection of a tab.

....
....
....
tabbedPane.addChangeListener(changeListener)
....
....
public void stateChanged(changeEvent)
{
   if(e.getSource() == tabbedPane)
   {
      int i = tabbedPane.getSelectedIndex();
      Component c = tabbedPane.getSelectedComponent();
   }
}
....
....