int index = -1;
int index = tabPane.getSelectedIndex();
  public int tabForCoordinate(JTabbedPane pane, int x, int y)  {    if (! tabPane.isValid())      tabPane.validate();    int tabCount = tabPane.getTabCount();    int index = -1;    for (int i = 0; i < tabCount; ++i)      {        if (rects[i].contains(x, y))          {            index = i;            break;          }      }    // FIXME: Handle scrollable tab layout.    return index;  }