sectionIndex--;
}
}
while (sectionIndex >= 0) {
Section section = sections.get(sectionIndex);
if (itemIndex == -1) {
int sectionLength = section.getLength();
itemIndex = sectionLength - 1;
}
while (itemIndex >= 0) {
Item item = section.get(itemIndex);
if (item.isEnabled()) {
item.setActive(true);
break;
}
itemIndex--;
}
if (itemIndex >= 0) {
break;
}
sectionIndex--;
}
consumed = true;
} else if (keyCode == Keyboard.KeyCode.DOWN) {
Menu.SectionSequence sections = menu.getSections();
int sectionCount = sections.getLength();
Menu.Item activeItem = menu.getActiveItem();
int sectionIndex;
int itemIndex;
if (activeItem == null) {
sectionIndex = 0;
itemIndex = 0;
} else {
Menu.Section section = activeItem.getSection();
sectionIndex = sections.indexOf(section);
itemIndex = section.indexOf(activeItem) + 1;
}
while (sectionIndex < sectionCount) {
Section section = sections.get(sectionIndex);
int sectionLength = section.getLength();
while (itemIndex < sectionLength) {
Item item = section.get(itemIndex);
if (item.isEnabled()) {
item.setActive(true);
break;
}