Allow to travers the whole tree from root using just Right key

This commit is contained in:
Konstantin Bulenkov
2016-10-04 00:07:34 +02:00
parent 096a0a2296
commit aa583de71b
@@ -168,14 +168,13 @@ public class WideSelectionTreeUI extends BasicTreeUI {
boolean leaf = tree.getModel().isLeaf(selectionPath.getLastPathComponent());
int toSelect = -1;
int toScroll = -1;
if (!leaf && tree.isExpanded(selectionRow)) {
if ((!leaf && tree.isExpanded(selectionRow)) || leaf) {
if (selectionRow + 1 < tree.getRowCount()) {
toSelect = selectionRow + 1;
toScroll = toSelect;
}
} else if (leaf) {
toScroll = selectionRow;
}
//todo[kb]: make cycle scrolling
if (toSelect != -1) {
tree.setSelectionInterval(toSelect, toSelect);