void (ActionEvent e) { int rowCount = getRowCount(); LOG.assertTrue(rowCount > 0); int selectedRow = getSelectedRow(); if (selectedRow == -1) { selectedRow = 0; } else { if (selectNext) { selectedRow = Math.min(rowCount - 1, getSelectedRow() + 1); } else { selectedRow = Math.max(0, selectedRow - 1); } } if (isEditing()) { finishEditing(); getSelectionModel().setSelectionInterval(selectedRow, selectedRow); scrollRectToVisible(getCellRect(selectedRow, 0, true)); startEditing(selectedRow); } else { getSelectionModel().setSelectionInterval(selectedRow, selectedRow); scrollRectToVisible(getCellRect(selectedRow, 0, true)); } }