for (int i = 0; i < myItems.length; i++) { Item item = myItems[i];   if (i == this.focusedIndex) { focusedY = y; item.getItemHeight( rightBorder - x, rightBorder - leftBorder ); } else {  item.paint(x, y, leftBorder, rightBorder, g); } y += item.itemHeight + this.paddingVertical; }  } else { x = leftBorder; int columnIndex = 0; int rowIndex = 0; for (int i = 0; i < myItems.length; i++) { Item item = myItems[i]; int columnWidth = this.columnsWidths[ columnIndex ];  if (item.colSpan > 1) { for (int j = columnIndex + 1; j < columnIndex + item.colSpan; j++) { columnWidth += this.columnsWidths[ j ] + this.paddingHorizontal; }   }  if (i == this.focusedIndex) { focusedY = y; focusedX = x; focusedRightBorder = x + columnWidth;  } else { item.paint(x, y, x, x + columnWidth, g); } x += columnWidth + this.paddingHorizontal;  if (item.colSpan > 1) { columnIndex += item.colSpan; } else { columnIndex++; }  columnIndex++;   if (columnIndex == this.numberOfColumns) { columnIndex = 0; y += this.rowsHeights[ rowIndex ] + this.paddingVertical; x = leftBorder; rowIndex++; } }
y += item.itemHeight + this.paddingVertical;
	protected void paintContent(int x, int y, int leftBorder, int rightBorder, Graphics g) {		// paints all items,		// the layout will be done according to this containers'		// layout or according to the items layout, when specified.		// adjust vertical start for scrolling:		//#if polish.debug.debug			if (this.yOffset != 0) {				//#debug				System.out.println("Container: drawing " + getClass().getName() + " with yOffset=" + this.yOffset );			}		//#endif		y += this.yOffset;		//#ifdef tmp.supportViewType			if (this.view != null) {				this.view.paintContent(x, y, leftBorder, rightBorder, g);				return;			}		//#endif		Item[] myItems;		//synchronized (this.itemsList) {			myItems = this.items;		//}		int focusedX = x;		int focusedY = 0;		int focusedRightBorder = rightBorder;		//#ifdef tmp.useTable		if (this.columnsSetting == NO_COLUMNS || myItems.length == 1) {		//#endif			if (!(this.isLayoutCenter || this.isLayoutRight)) {				// adjust the right border:				rightBorder = leftBorder + this.contentWidth;			}			for (int i = 0; i < myItems.length; i++) {				Item item = myItems[i];				// currently the NEWLINE_AFTER and NEWLINE_BEFORE layouts will be ignored,				// since after every item a line break will be done.				if (i == this.focusedIndex) {					focusedY = y;					item.getItemHeight( rightBorder - x, rightBorder - leftBorder );				} else {					// the currently focused item is painted last					item.paint(x, y, leftBorder, rightBorder, g);				}				y += item.itemHeight + this.paddingVertical;			}		//#ifdef tmp.useTable		} else {			x = leftBorder;			int columnIndex = 0;			int rowIndex = 0;			for (int i = 0; i < myItems.length; i++) {				Item item = myItems[i];				int columnWidth = this.columnsWidths[ columnIndex ];				//#if polish.css.colspan					if (item.colSpan > 1) {												for (int j = columnIndex + 1; j < columnIndex + item.colSpan; j++) {							columnWidth += this.columnsWidths[ j ] + this.paddingHorizontal;						}						//System.out.println("Painting item " + i + "/" + item + " with width=" + item.itemWidth + " and with increased colwidth of " + columnWidth + " (prev=" + this.columnsWidths[ columnIndex ] + ")" );											}				//#endif				if (i == this.focusedIndex) {					focusedY = y;					focusedX = x;					focusedRightBorder = x + columnWidth;					// item.getItemHeight( columnWidth, columnWidth );				} else {					item.paint(x, y, x, x + columnWidth, g);				}				x += columnWidth + this.paddingHorizontal;				//#if polish.css.colspan					if (item.colSpan > 1) {						columnIndex += item.colSpan;					} else {						columnIndex++;					}				//#else					columnIndex++;				//#endif						if (columnIndex == this.numberOfColumns) {					columnIndex = 0;					y += this.rowsHeights[ rowIndex ] + this.paddingVertical;					x = leftBorder;					rowIndex++;				}			}		}		//#endif				// paint the currently focused item:		if (this.focusedItem != null) {			//System.out.println("Painting focusedItem " + this.focusedItem + " with width=" + this.focusedItem.itemWidth + " and with increased colwidth of " + (focusedRightBorder - focusedX)  );			this.focusedItem.paint(focusedX, focusedY, focusedX, focusedRightBorder, g);		}	}