void (Object element, String selectedText) { if (element instanceof Integer) { final int index = ((Integer)element).intValue(); final int row = index / myComponent.getColumnCount(); final int col = index % myComponent.getColumnCount(); myComponent.getSelectionModel().setSelectionInterval(row, row); myComponent.getColumnModel().getSelectionModel().setSelectionInterval(col, col); TableUtil.scrollSelectionToVisible(myComponent); } else { myComponent.getSelectionModel().clearSelection(); myComponent.getColumnModel().getSelectionModel().clearSelection(); } }