@Override protected void setSelectedIndex(int index, boolean incremental) { int majorIndex, minorIndex; JTable table = ((JTable) _component); if (isColumnSelectionAllowed(table)) { minorIndex = index; majorIndex = getMainIndex(); addTableSelection(table, majorIndex, minorIndex, incremental); } else if (isRowSelectionAllowed(table)) { majorIndex = index; minorIndex = table.convertColumnIndexToView(getMainIndex()); addTableSelection(table, majorIndex, minorIndex, incremental); } else { // cell selection allowed int columnCount = table.getColumnCount(); if (columnCount == 0) { return; } majorIndex = index / columnCount; minorIndex = index % columnCount; addTableSelection(table, majorIndex, minorIndex, incremental); } }