void (final ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel)e.getSource(); int i = lsm.getMaxSelectionIndex(); int j = lsm.getMinSelectionIndex(); if (i >= 0 && i == j) { listener.consume(myCommits.get(i)); } }