*/
@Override
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
ListButton listButton = (ListButton)getComponent();
if (keyCode == Keyboard.KeyCode.SPACE) {
pressed = true;
repaintComponent();
if (listViewPopup.isOpen()) {
listViewPopup.close();
} else if (!listButton.isRepeatable()){
listViewPopup.open(component.getWindow());
}
} else if (keyCode == Keyboard.KeyCode.UP) {
int index = listButton.getSelectedIndex();
do {
index--;
} while (index >= 0
&& listButton.isItemDisabled(index));
if (index >= 0) {
listButton.setSelectedIndex(index);
consumed = true;
}
} else if (keyCode == Keyboard.KeyCode.DOWN) {
if (Keyboard.isPressed(Keyboard.Modifier.ALT)) {
listViewPopup.open(component.getWindow());
consumed = true;
} else {
int index = listButton.getSelectedIndex();
int count = listButton.getListData().getLength();
do {
index++;
} while (index < count
&& listView.isItemDisabled(index));
if (index < count) {
listButton.setSelectedIndex(index);
consumed = true;
}
}
} else {
consumed = super.keyPressed(component, keyCode, keyLocation);