int width = item.getItemWidth( lineWidth, lineWidth ); if (width > myContentWidth) { myContentWidth = width; }
width = item.getItemWidth( lineWidth, lineWidth );
	protected void initContent(int firstLineWidth, int lineWidth) {		//#debug		System.out.println("Container: intialising content for " + this + ": autofocus=" + this.autoFocusEnabled);		int myContentWidth = 0;		int myContentHeight = 0;		try {		Item[] myItems = (Item[]) this.itemsList.toArray( new Item[ this.itemsList.size() ]);		this.items = myItems;		if (this.autoFocusEnabled && this.autoFocusIndex >= myItems.length ) {			this.autoFocusIndex = 0;		}		//#ifdef tmp.supportViewType			if (this.view != null) {				boolean requireScrolling = this.isScrollRequired;				if (this.autoFocusEnabled) {					//#debug					System.out.println("Container/View: autofocusing element " + this.autoFocusIndex);					this.autoFocusEnabled = false;					requireScrolling = true;					if (this.autoFocusIndex < myItems.length  && this.autoFocusIndex >= 0 ) {						Item item = myItems [ this.autoFocusIndex ];						if (item.appearanceMode != Item.PLAIN) {							// make sure that the item has applied it's own style first:							item.getItemHeight( firstLineWidth, lineWidth );							// now focus the item:							focus( this.autoFocusIndex, item, 0 );							this.view.focusedIndex = this.autoFocusIndex;							this.view.focusedItem = this.focusedItem;						}					}				}				this.view.initContent(this, firstLineWidth, lineWidth);				this.contentWidth = this.view.contentWidth;				this.contentHeight = this.view.contentHeight;				this.appearanceMode = this.view.appearanceMode;				if (requireScrolling && this.enableScrolling && this.focusedItem != null) {					//#debug					System.out.println("initContent(): scrolling autofocused or scroll-required item for view");					Item item = this.focusedItem;					scroll( true, item.xLeftPos, item.yTopPos, item.itemWidth, item.itemHeight );				}				return;			}		//#endif					boolean isLayoutShrink = (this.layout & LAYOUT_SHRINK) == LAYOUT_SHRINK;		boolean hasFocusableItem = false;		for (int i = 0; i < myItems.length; i++) {			Item item = myItems[i];			//System.out.println("initalising " + item.getClass().getName() + ":" + i);			int width = item.getItemWidth( lineWidth, lineWidth );			int height = item.itemHeight; // no need to call getItemHeight() since the item is now initialised...			// now the item should have a style, so it can be safely focused			// without loosing the style information:			if (item.appearanceMode != PLAIN) {				hasFocusableItem = true;			}			if (this.autoFocusEnabled  && (i >= this.autoFocusIndex ) && (item.appearanceMode != Item.PLAIN)) {				//#debug				System.out.println("Container: autofocusing element " + i);				this.autoFocusEnabled = false;				focus( i, item, 0 );				height = item.getItemHeight(lineWidth, lineWidth);				if (!isLayoutShrink) {					width = item.itemWidth;  // no need to call getItemWidth() since the item is now initialised...				} else {					width = 0;				}				if (this.enableScrolling) {					//#debug					System.out.println("initContent(): scrolling autofocused item");					scroll( true, 0, myContentHeight, width, height );				}			} else if (i == this.focusedIndex) {				if (isLayoutShrink) {					width = 0;				}				if (this.isScrollRequired) {					//#debug					System.out.println("initContent(): scroll is required.");					scroll( true, 0, myContentHeight, width, height );					this.isScrollRequired = false;				}			} 			if (width > myContentWidth) {				myContentWidth = width; 			}			item.yTopPos = myContentHeight;			item.yBottomPos = myContentHeight + height;			myContentHeight += height + this.paddingVertical;			//System.out.println("item.yTopPos=" + item.yTopPos);		}		if (!hasFocusableItem) {			this.appearanceMode = PLAIN;		} else {			this.appearanceMode = INTERACTIVE;			if (isLayoutShrink && this.focusedItem != null) {				Item item = this.focusedItem;				//System.out.println("container has shrinking layout and contains focuse item " + item);				item.isInitialised = false;				boolean doExpand = item.isLayoutExpand;				if (doExpand) {					item.isLayoutExpand = false;					int width = item.getItemWidth( lineWidth, lineWidth );					if (width > myContentWidth) {						myContentWidth = width;					}					item.isInitialised = false;					item.isLayoutExpand = doExpand;				}				if ( this.minimumWidth != 0 && myContentWidth < this.minimumWidth ) {					myContentWidth = this.minimumWidth;				}				//myContentHeight += item.getItemHeight( lineWidth, lineWidth );			}		}		} catch (ArrayIndexOutOfBoundsException e) {			//#debug error			System.out.println("Unable to init container " + e );		}		this.contentHeight = myContentHeight;		this.contentWidth = myContentWidth;		}