private static int getResizingColumn(JTableHeader tableHeader, Point location) {
        int column = tableHeader.columnAtPoint(location);
        Rectangle rect = tableHeader.getHeaderRect(column);
        rect.grow(-3, 0);
        if (rect.contains(location)) {
            return -1;
        }

        int middle = rect.x + rect.width / 2;
        if (tableHeader.getComponentOrientation().isLeftToRight()) {
            column = (location.x < middle) ? column - 1 : column;
        } else {
            column = (location.x < middle) ? column : column - 1;
        }
        return column;
    }