int cellIndex = getCellIndex(date.getYear(), date.getMonth(), date.getDay());
int rowIndex = cellIndex / 7;
int columnIndex = cellIndex % 7;
Component nextButton;
switch (keyCode) {
case Keyboard.KeyCode.UP: {
do {
rowIndex--;
if (rowIndex < 0) {
rowIndex = 5;
}
TablePane.Row row = tablePane.getRows().get(rowIndex + 2);
nextButton = row.get(columnIndex);
} while (!nextButton.isEnabled());
nextButton.requestFocus();
break;
}
case Keyboard.KeyCode.DOWN: {
do {
rowIndex++;
if (rowIndex > 5) {
rowIndex = 0;
}
TablePane.Row row = tablePane.getRows().get(rowIndex + 2);
nextButton = row.get(columnIndex);
} while (!nextButton.isEnabled());
nextButton.requestFocus();
break;
}
case Keyboard.KeyCode.LEFT: {
TablePane.Row row = tablePane.getRows().get(rowIndex + 2);
do {
columnIndex--;
if (columnIndex < 0) {
columnIndex = 6;
}
nextButton = row.get(columnIndex);
} while (!nextButton.isEnabled());
nextButton.requestFocus();
break;
}
case Keyboard.KeyCode.RIGHT: {
TablePane.Row row = tablePane.getRows().get(rowIndex + 2);
do {
columnIndex++;
if (columnIndex > 6) {
columnIndex = 0;
}
nextButton = row.get(columnIndex);
} while (!nextButton.isEnabled());
nextButton.requestFocus();
break;
}
}
consumed = true;