void (ActionEvent e) { int selIndexBefore = getSelectedIndex(); myDefaultAction.actionPerformed(e); int selIndexCurrent = getSelectedIndex(); if (mySelectNext && selIndexBefore < selIndexCurrent || !mySelectNext && selIndexBefore > selIndexCurrent) { return; } if (mySelectNext) { if (selIndexCurrent == selIndexBefore + 1) { selIndexCurrent++; } if (selIndexCurrent < getModel().getSize() - 1) { setSelectedIndex(selIndexCurrent + 1); scrollRectToVisible(getCellBounds(selIndexCurrent + 1, selIndexCurrent + 1)); } } else if (selIndexCurrent > 0) { setSelectedIndex(selIndexCurrent - 1); scrollRectToVisible(getCellBounds(selIndexCurrent - 1, selIndexCurrent - 1)); } }