void (boolean forward, JBList list) { final int index = list.getSelectedIndex(); final RunAnythingSearchListModel model = getSearchingModel(list); if (model != null && index >= 0) { final int newIndex = forward ? model.next(index) : model.prev(index); list.setSelectedIndex(newIndex); int more = model.next(newIndex) - 1; if (more < newIndex) { more = list.getItemsCount() - 1; } ScrollingUtil.ensureIndexIsVisible(list, more, forward ? 1 : -1); ScrollingUtil.ensureIndexIsVisible(list, newIndex, forward ? 1 : -1); } }