if ( item.contentY + item.internalY + item.internalHeight > this.yBottom) {  if (!this.scrollSmooth) { this.yOffset -= ( item.contentY + item.internalY + item.internalHeight - this.yBottom ); } else {  this.targetYOffset -= ( item.contentY + item.internalY + item.internalHeight - this.yBottom );  }   System.out.println("Container (" + getClass().getName() + "): lowered yOffset to " + this.yOffset + "/" + this.targetYOffset  ); } else if ( item.contentY + item.internalY < this.yTop ) {  if (!this.scrollSmooth) { this.yOffset += ( this.yTop - (item.contentY + item.internalY  )); } else {  this.targetYOffset += ( this.yTop - (item.contentY + item.internalY  ));  }   System.out.println("Container (" + getClass().getName() + "): increased yOffset to " + this.yOffset + "/" + this.targetYOffset + ", yTop=" + this.yTop + ", item.class=" + item.getClass().getName() + ", item.contentY=" + item.contentY + ", item.internalY=" + item.internalY ); }
adjustScrolling(item);
	protected boolean handleKeyPressed(int keyCode, int gameAction) {		if (this.itemsList.size() == 0) {			return false;		}		if (this.focusedItem != null) {			Item item = this.focusedItem;			if ( item.handleKeyPressed(keyCode, gameAction) ) {				if (this.enableScrolling && item.internalX != -9999) {					if ( item.contentY + item.internalY + item.internalHeight > this.yBottom) {						//#if polish.css.scroll-mode							if (!this.scrollSmooth) {								this.yOffset -= ( item.contentY + item.internalY + item.internalHeight - this.yBottom );							} else {						//#endif								this.targetYOffset -= ( item.contentY + item.internalY + item.internalHeight - this.yBottom );						//#if polish.css.scroll-mode							}						//#endif						//#debug						System.out.println("Container (" + getClass().getName() + "): lowered yOffset to " + this.yOffset + "/" + this.targetYOffset  );					} else if ( item.contentY + item.internalY < this.yTop ) {						//#if polish.css.scroll-mode							if (!this.scrollSmooth) {								this.yOffset += ( this.yTop - (item.contentY + item.internalY  )); 							} else {						//#endif								this.targetYOffset += ( this.yTop - (item.contentY + item.internalY  )); 						//#if polish.css.scroll-mode							}						//#endif						//#debug						System.out.println("Container (" + getClass().getName() + "): increased yOffset to " + this.yOffset + "/" + this.targetYOffset + ", yTop=" + this.yTop + ", item.class=" + item.getClass().getName() + ", item.contentY=" + item.contentY + ", item.internalY=" + item.internalY );					}				}				//#debug				System.out.println("Container(" + this + "): handleKeyPressed consumed by item " + item.getClass().getName() + "/" + item );								return true;			}			}		// now allow a navigation within the container:		//#ifdef tmp.supportViewType			if (this.view != null) {				boolean handled = this.view.handleKeyPressed(keyCode, gameAction);				if (handled) {					return true;				}//				Item next = this.view.getNextItem(keyCode, gameAction);//				if (next != null) {//					focus( this.view.focusedIndex, next, gameAction );//					return true;//				} else 				if (this.enableScrolling) {										if (gameAction == Canvas.UP && this.targetYOffset < 0 ) {						//#if polish.Container.ScrollDelta:defined							//#= this.targetYOffset += ${polish.Container.ScrollDelta};						//#else							this.targetYOffset += 30;						//#endif						if (this.targetYOffset > 0 ) {							this.targetYOffset = 0;						}						//#if polish.scroll-mode							if (!this.scrollSmooth) {								this.yOffset = this.targetYOffset;							}						//#endif						return true;					}					if (gameAction == Canvas.DOWN							&& (this.itemHeight + this.targetYOffset > (this.yBottom - this.yTop)) ) 					{						//#if polish.Container.ScrollDelta:defined							//#= this.targetYOffset -= ${polish.Container.ScrollDelta};						//#else							this.targetYOffset -= 30;						//#endif						//#if polish.scroll-mode							if (!this.scrollSmooth) {								this.yOffset = this.targetYOffset;							}						//#endif						return true;					}				}				return false;			}		//#endif		boolean processed = false;		if ( (gameAction == Canvas.RIGHT  && keyCode != Canvas.KEY_NUM6) 				|| (gameAction == Canvas.DOWN  && keyCode != Canvas.KEY_NUM8)) {			processed = shiftFocus( true, 0 );			//#debug			System.out.println("Container(" + this + "): forward shift by one item succeded: " + processed + ", focusedIndex=" + this.focusedIndex );			if ((!processed) && this.enableScrolling 					&&  (this.yBottomPos + this.targetYOffset > this.yBottom)) {				// scroll downwards:				//#if polish.Container.ScrollDelta:defined					//#= this.targetYOffset -= ${polish.Container.ScrollDelta};				//#else					this.targetYOffset -= 30;				//#endif				//#debug				System.out.println("Down/Right: Reducing targetYOffset to " + this.targetYOffset);					processed = true;				//System.out.println("yBottomPos: " + this.yBottomPos + "  yBottom: " + this.yBottom );				//#if polish.scroll-mode					if (!this.scrollSmooth) {						this.yOffset = this.targetYOffset;					}				//#endif			}		} else if ( (gameAction == Canvas.LEFT  && keyCode != Canvas.KEY_NUM4) 				|| (gameAction == Canvas.UP && keyCode != Canvas.KEY_NUM2) ) {			processed = shiftFocus( false, 0 );			if ((!processed) && this.enableScrolling && (this.targetYOffset < 0)) {				// scroll upwards:				//#if polish.Container.ScrollDelta:defined					//#= this.targetYOffset += ${polish.Container.ScrollDelta};				//#else					this.targetYOffset += 30;				//#endif				//#debug				System.out.println("Up/Left: Increasing targetYOffset to " + this.targetYOffset);					if (this.targetYOffset > 0) {					this.targetYOffset = 0;				}				processed = true;				//#if polish.scroll-mode					if (!this.scrollSmooth) {						this.yOffset = this.targetYOffset;					}				//#endif			}		}		return processed;	}