selectedIndex = x / (elemSize.getWidth() + itemGap);
}
} else {
int numOfcomponents = getModel().getSize();
Rectangle pos = new Rectangle();
Style style = getStyle();
int width = getWidth() - style.getPadding(RIGHT) - style.getPadding(LEFT) - getSideGap();
if (isScrollableX()) {
width = Math.max(width, getPreferredSize().getWidth() - style.getPadding(RIGHT) - style.getPadding(LEFT) - getSideGap());
}
Dimension rendererSize = getElementSize(false);
Dimension selectedSize = getElementSize(true);
for (int i = 0; i < numOfcomponents; i++) {
calculateComponentPosition(i, width, pos, rendererSize, selectedSize, true);