static int indexOfTabComponent(JTabbedPane tabs, Component c) swing {
  if (tabs == null || c == null) ret -1;
  int n = tabs.getTabCount();
  for i to n:
    if (isGrandChildOf_limitedBy(c, tabs.getTabComponentAt(i), tabs)
      || isGrandChildOf_limitedBy(c, tabs.getComponentAt(i), tabs))
      ret i;
  ret -1;
}

static int indexOfTabComponent(JExtendedTabbedPane tabs, Component c) swing {
  if (tabs == null || c == null) ret -1;
  int n = tabs.getTabCount();
  for i to n:
    if (isGrandChildOf_limitedBy(c, tabs.getTabComponentAt(i), tabs.visualize())
      || isGrandChildOf_limitedBy(c, tabs.getComponentAt(i), tabs.visualize()))
      ret i;
  ret -1;
}