(int gameAction)
| 4437 | } |
| 4438 | |
| 4439 | private void updateFocus(int gameAction) { |
| 4440 | Component focused = getFocused(); |
| 4441 | switch (gameAction) { |
| 4442 | case Display.GAME_DOWN: { |
| 4443 | Component down = findNextFocusDown(); |
| 4444 | if (down != null) { |
| 4445 | focused = down; |
| 4446 | } |
| 4447 | break; |
| 4448 | } |
| 4449 | case Display.GAME_UP: { |
| 4450 | Component up = findNextFocusUp(); |
| 4451 | if (up != null) { |
| 4452 | focused = up; |
| 4453 | } |
| 4454 | break; |
| 4455 | } |
| 4456 | case Display.GAME_RIGHT: { |
| 4457 | Component right = findNextFocusRight(); |
| 4458 | if (right != null) { |
| 4459 | focused = right; |
| 4460 | } |
| 4461 | break; |
| 4462 | } |
| 4463 | case Display.GAME_LEFT: { |
| 4464 | Component left = findNextFocusLeft(); |
| 4465 | if (left != null) { |
| 4466 | focused = left; |
| 4467 | } |
| 4468 | break; |
| 4469 | } |
| 4470 | default: |
| 4471 | return; |
| 4472 | } |
| 4473 | |
| 4474 | //if focused is now visible we need to give it the focus. |
| 4475 | if (isFocusScrolling()) { |
| 4476 | setFocused(focused); |
| 4477 | if (focused != null) { |
| 4478 | scrollComponentToVisible(focused); |
| 4479 | } |
| 4480 | } else { |
| 4481 | if (moveScrollTowards(gameAction, focused)) { |
| 4482 | setFocused(focused); |
| 4483 | scrollComponentToVisible(focused); |
| 4484 | } |
| 4485 | } |
| 4486 | |
| 4487 | } |
| 4488 | |
| 4489 | /// {@inheritDoc} |
| 4490 | @Override |
no test coverage detected