int (Point point) { if (lastSingRowLayout == null) return -1; int result = -1; Component c = myTabs.getComponentAt(point); if (c instanceof JBTabsImpl) { for (int i = 0; i < lastSingRowLayout.myVisibleInfos.size() - 1; i++) { TabLabel first = myTabs.getInfoToLabel().get(lastSingRowLayout.myVisibleInfos.get(i)); TabLabel second = myTabs.getInfoToLabel().get(lastSingRowLayout.myVisibleInfos.get(i + 1)); Rectangle firstBounds = first.getBounds(); Rectangle secondBounds = second.getBounds(); final boolean between; boolean horizontal = getStrategy() instanceof SingleRowLayoutStrategy.Horizontal; if (horizontal) { between = firstBounds.getMaxX() < point.x && secondBounds.getX() > point.x && firstBounds.y < point.y && secondBounds.getMaxY() > point.y; } else { between = firstBounds.getMaxY() < point.y && secondBounds.getY() > point.y && firstBounds.x < point.x && secondBounds.getMaxX() > point.x; } if (between) { c = first; break; } } } if (c instanceof TabLabel) { TabInfo info = ((TabLabel)c).getInfo(); int index = lastSingRowLayout.myVisibleInfos.indexOf(info); boolean isDropTarget = myTabs.isDropTarget(info); if (!isDropTarget) { for (int i = 0; i <= index; i++) { if (myTabs.isDropTarget(lastSingRowLayout.myVisibleInfos.get(i))) { index -= 1; break; } } result = index; } else if (index < lastSingRowLayout.myVisibleInfos.size()) { result = index; } } return result; }