@Override
  public int getDropIndexFor(Point point) {
    if (lastTableLayout == null) return -1;
    int result = -1;

    Component c = myTabs.getComponentAt(point);
    Set<TabInfo> lastInRow = new HashSet<>();
    for (int i = 0; i < lastTableLayout.table.size(); i++) {
      List<TabInfo> columns = lastTableLayout.table.get(i).myColumns;
      if (!columns.isEmpty()) {
        lastInRow.add(columns.get(columns.size() - 1));
      }
    }

    if (c instanceof JBTabsImpl) {
      for (int i = 0; i < lastTableLayout.visibleInfos.size() - 1; i++) {
        TabInfo firstInfo = lastTableLayout.visibleInfos.get(i);
        TabInfo secondInfo = lastTableLayout.visibleInfos.get(i + 1);
        TabLabel first = myTabs.getTabLabel(firstInfo);
        TabLabel second = myTabs.getTabLabel(secondInfo);

        Rectangle firstBounds = Objects.requireNonNull(first).getBounds();
        Rectangle secondBounds = second.getBounds();

        final boolean between = firstBounds.getMaxX() < point.x
                                && secondBounds.getX() > point.x
                                && firstBounds.y < point.y
                                && secondBounds.getMaxY() > point.y;

        if (between) {
          c = first;
          break;
        }
        if (lastInRow.contains(firstInfo)
            && firstBounds.y <= point.y
            && firstBounds.getMaxY() >= point.y
            && firstBounds.getMaxX() <= point.x) {
          c = second;
          break;
        }
      }
    }

    if (c instanceof TabLabel) {
      TabInfo info = ((TabLabel)c).getInfo();
      int index = lastTableLayout.visibleInfos.indexOf(info);
      boolean isDropTarget = myTabs.isDropTarget(info);
      if (!isDropTarget) {
        for (int i = 0; i <= index; i++) {
          if (myTabs.isDropTarget(lastTableLayout.visibleInfos.get(i))) {
            index -= 1;
            break;
          }
        }
        result = index;
      }
      else if (index < lastTableLayout.visibleInfos.size()) {
        result = index;
      }
    }
    return result;
  }
@Override
  public int getDropIndexFor(Point point)