(int selectedIndex)
| 1000 | } |
| 1001 | |
| 1002 | void selectElement(int selectedIndex) { |
| 1003 | Dimension size = getElementSize(false, true); |
| 1004 | Rectangle rect; |
| 1005 | if (getOrientation() != HORIZONTAL) { |
| 1006 | rect = new Rectangle(getX(), (size.getHeight() + itemGap) * selectedIndex, getElementSize(true, true)); |
| 1007 | } else { |
| 1008 | int x = (size.getWidth() + itemGap) * selectedIndex; |
| 1009 | if (isRTL() && isScrollableX()) { |
| 1010 | x = getScrollDimension().getWidth() - x - (size.getWidth() + itemGap); |
| 1011 | } |
| 1012 | rect = new Rectangle(x, getY(), getElementSize(true, true)); |
| 1013 | } |
| 1014 | if (hasScrollableParent(getParent())) { |
| 1015 | if (hasFocus()) { |
| 1016 | scrollRectToVisible(rect); |
| 1017 | } |
| 1018 | } else { |
| 1019 | scrollRectToVisible(rect); |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | private boolean hasScrollableParent(Container c) { |
| 1024 | if (c == null) { |
no test coverage detected