void (JTable table) { int row = table.getSelectedRowCount() == 1 ? table.getSelectedRow() : -1; int column = table.getSelectedColumnCount() == 1 ? table.getSelectedColumn() : -1; handleSelectionChange((row == -1 || column == -1) ? null : new TableCell(row, column)); }