for (int i = 0; i <= selectedIndex; i++) {
for (int i = 0; i <= highlightedItemIndex; i++) {
  int traverse(int gameKeyCode, int top, int bottom, boolean action)  {    if (gameKeyCode == 1) {      if (selectedIndex > 0) {				if (action) {        	selectedIndex--;				}				int height = super.getHeight();				for (int i = 0; i < selectedIndex; i++) {					height += items[i].getHeight();				}				if (height < top) {					return height - top;				} else {					repaint();				}      } else {				if (top > 0) {					return -top;				} else {					return Item.OUTOFITEM;				}			}    }    if (gameKeyCode == 6) {      if (selectedIndex < (numOfItems - 1)) {				if (action) {	        selectedIndex++;				}				int height = super.getHeight();				for (int i = 0; i <= selectedIndex; i++) {					height += items[i].getHeight();				}				if (height > bottom) {					return height - bottom;				} else {			    repaint();				}      } else {				return Item.OUTOFITEM;			}    }		return 0;  }