int (final int x,final int y) { final TabbedPaneUI ui=getUI(); for (int i = 0; i < getTabCount(); i++) { final Rectangle bounds = ui.getTabBounds(this, i); if (bounds.contains(x, y)) { return i; } } return -1; }