this.paintScrollIndicatorDown = (this.menuContainer.yOffset + menuHeight > this.screenHeight - tHeight);
this.paintScrollIndicatorDown = (this.menuContainer.yOffset + menuHeight > this.originalScreenHeight - tHeight);
	public final void paint(Graphics g) {		//#if tmp.fullScreenInPaint			if (!this.isInFullScreenMode) {				super.setFullScreenMode( true );				this.isInFullScreenMode = true;				//#ifdef polish.FullCanvasHeight:defined					//#= this.fullScreenHeight = ${polish.FullCanvasHeight};				//#else					this.fullScreenHeight = getHeight();				//#endif				this.screenHeight = this.fullScreenHeight - this.menuBarHeight;				this.originalScreenHeight = this.screenHeight;				this.scrollIndicatorY = this.screenHeight - this.scrollIndicatorWidth - 1;			}		//#endif					//#if polish.useFullScreen && polish.api.nokia-ui 			this.isInPaintMethod = true;		//#endif		//#ifdef polish.debug.error		try {		//#endif			// paint background:			if (this.background != null) {				//#ifdef tmp.menuFullScreen					this.background.paint(0, 0, this.screenWidth, this.fullScreenHeight, g);				//#else					this.background.paint(0, 0, this.screenWidth, this.screenHeight, g);				//#endif			} else {				g.setColor( 0xFFFFFF );				//#ifdef tmp.menuFullScreen					g.fillRect( 0, 0, this.screenWidth, this.fullScreenHeight );				//#else					g.fillRect( 0, 0, this.screenWidth, this.screenHeight );				//#endif			}						int tHeight = 0;			//#ifdef tmp.usingTitle				// paint title:				if (this.title != null && this.showTitleOrMenu) {					this.title.paint(0, 0, 0, this.screenWidth, g);					tHeight = this.titleHeight;				}			//#endif			if (this.subTitle != null) {				this.subTitle.paint( 0, tHeight, 0, this.screenWidth, g );				tHeight += this.subTitleHeight;			}			if (this.showInfoItem) {				this.infoItem.paint( 0, tHeight, 0, this.screenWidth, g );				tHeight += this.infoHeight;			}			// protect the title, ticker and the full-screen-menu area:			g.setClip(0, tHeight, this.screenWidth, this.screenHeight - tHeight );			g.translate( 0, tHeight );			// paint content:			//System.out.println("starting to paint content of screen");			paintScreen( g );			//System.out.println("done painting content of screen");						g.translate( 0, - tHeight );			// allow painting outside of the screen again:			//#ifdef tmp.menuFullScreen			 	g.setClip(0, 0, this.screenWidth, this.fullScreenHeight );			//#else			 	g.setClip(0, 0, this.screenWidth, this.originalScreenHeight );			//#endif			 			//#ifndef polish.skipTicker			 	if (this.ticker != null) {			 		this.ticker.paint( 0, this.screenHeight, 0, this.screenWidth, g );			 	}			//#endif						// paint border:			if (this.border != null) {				this.border.paint(0, 0, this.screenWidth, this.screenHeight, g);			}						// paint menu in full-screen mode:			//#ifdef tmp.menuFullScreen				//#ifdef tmp.useExternalMenuBar					this.menuBar.paint(0, this.screenHeight, 0, this.screenWidth, g);					if (this.menuBar.isOpened) {						this.paintScrollIndicator = this.menuBar.paintScrollIndicator;						this.paintScrollIndicatorUp = this.menuBar.canScrollUpwards;						this.paintScrollIndicatorDown = this.menuBar.canScrollDownwards;					}				//#else					if (this.menuOpened) {						tHeight -= this.infoHeight;						int menuHeight = this.menuContainer.getItemHeight(this.menuMaxWidth, this.menuMaxWidth);						int y = this.originalScreenHeight - menuHeight;						if (y < tHeight) {							this.paintScrollIndicator = true;							this.paintScrollIndicatorUp = (this.menuContainer.yOffset != 0);							this.paintScrollIndicatorDown = (this.menuContainer.yOffset + menuHeight > this.screenHeight - tHeight);							y = tHeight; 							this.menuContainer.setVerticalDimensions(y, this.screenHeight);						} else {							this.paintScrollIndicator = false;						}						g.setClip(0, tHeight, this.screenWidth, this.screenHeight - tHeight );						this.menuContainer.paint(0, y, 0, this.menuMaxWidth, g);					 	g.setClip(0, 0, this.screenWidth, this.fullScreenHeight );					} 					if (this.showTitleOrMenu || this.menuOpened) {						// clear menu-bar:						if (this.menuBarColor != Item.TRANSPARENT) {							g.setColor( this.menuBarColor );							g.fillRect(0, this.originalScreenHeight, this.screenWidth,  this.menuBarHeight );						}						if (this.menuContainer != null && this.menuContainer.size() > 0) {							String menuText = null;							if (this.menuOpened) {								//#ifdef polish.command.select:defined									//#= menuText = "${polish.command.select}";								//#else									menuText = "Select";								//#endif							} else {								if (this.menuSingleLeftCommand != null) {									menuText = this.menuSingleLeftCommand.getLabel();								} else {									//#ifdef polish.command.options:defined										//#= menuText = "${polish.command.options}";									//#else										menuText = "Options";													//#endif								}							}							//#ifdef polish.hasPointerEvents								this.menuLeftCommandX = 2 + this.menuFont.stringWidth( menuText );							//#endif							g.setColor( this.menuFontColor );							g.setFont( this.menuFont );							//#ifdef polish.Menu.MarginLeft:defined								//#= int menuX = ${polish.Menu.MarginLeft};							//#else								int menuX = 2;							//#endif							//#ifdef polish.Menu.MarginTop:defined								//#= g.drawString(menuText, menuX, this.originalScreenHeight + ${polish.Menu.MarginTop}, Graphics.TOP | Graphics.LEFT );							//#else								g.drawString(menuText, menuX, this.originalScreenHeight + 2, Graphics.TOP | Graphics.LEFT );							//#endif							if ( this.menuOpened ) {								// draw cancel string:								//#ifdef polish.command.cancel:defined									//#= menuText = "${polish.command.cancel}";								//#else									menuText = "Cancel";								//#endif								//#ifdef polish.Menu.MarginRight:defined									//#= menuX = ${polish.Menu.MarginRight};								//#elifdef polish.Menu.MarginLeft:defined									menuX = 2;								//#endif								//#ifdef polish.Menu.MarginTop:defined									//#= g.drawString(menuText, this.screenWidth - menuX, this.originalScreenHeight + ${polish.Menu.MarginTop}, Graphics.TOP | Graphics.RIGHT );								//#else									g.drawString(menuText, this.screenWidth - menuX, this.originalScreenHeight + 2, Graphics.TOP | Graphics.RIGHT );								//#endif								//#ifdef polish.hasPointerEvents									this.menuRightCommandX = this.screenWidth - 2 - this.menuFont.stringWidth( menuText );								//#endif							}						}						if (this.menuSingleRightCommand != null && !this.menuOpened) {							g.setColor( this.menuFontColor );							g.setFont( this.menuFont );							String menuText = this.menuSingleRightCommand.getLabel();							//#ifdef polish.Menu.MarginRight:defined								//#= int menuX = ${polish.Menu.MarginRight};							//#else								int menuX = 2;							//#endif							//#ifdef polish.Menu.MarginTop:defined								//#= g.drawString(menuText, this.screenWidth - menuX, this.originalScreenHeight + ${polish.Menu.MarginTop}, Graphics.TOP | Graphics.RIGHT );							//#else								g.drawString(menuText, this.screenWidth - menuX, this.originalScreenHeight + 2, Graphics.TOP | Graphics.RIGHT );							//#endif							//#ifdef polish.hasPointerEvents								this.menuRightCommandX = this.screenWidth - menuX 									- this.menuFont.stringWidth( menuText );							//#endif						}					} // if this.showTitleOrMenu || this.menuOpened				//#endif			//#endif			// paint scroll-indicator in the middle of the menu:			if (this.paintScrollIndicator) {				g.setColor( this.scrollIndicatorColor );				int x = this.scrollIndicatorX;				int y = this.scrollIndicatorY;				int width = this.scrollIndicatorWidth;				int halfWidth = width / 2;				if (this.paintScrollIndicatorUp) {					//#ifdef polish.midp2						g.fillTriangle(x, y + halfWidth-1, x + width, y + halfWidth-1, x + halfWidth, y );					//#else						g.drawLine( x, y + halfWidth-1, x + width, y + halfWidth-1 );						g.drawLine( x, y + halfWidth-1, x + halfWidth, y );						g.drawLine( x + width, y + halfWidth-1, x + halfWidth, y );					//#endif				}				if (this.paintScrollIndicatorDown) {					//#ifdef polish.midp2						g.fillTriangle(x, y + halfWidth+1, x + width, y + halfWidth+1, x + halfWidth, y + width );					//#else						g.drawLine( x, y + halfWidth+1, x + width, y + halfWidth+1 );						g.drawLine( x, y + halfWidth+1, x + halfWidth, y + width );						g.drawLine(x + width, y + halfWidth+1, x + halfWidth, y + width );					//#endif				}			}			//#ifdef polish.css.foreground-image				if (this.foregroundImage != null) {					g.drawImage( this.foregroundImage, this.foregroundX, this.foregroundY, Graphics.TOP | Graphics.LEFT  );				}			//#endif		//#ifdef polish.debug.error		} catch (RuntimeException e) {			//#debug error			Debug.debug( "unable to paint screen", e );		}		//#endif		//#if polish.useFullScreen && polish.api.nokia-ui 			this.lastPaintTime = System.currentTimeMillis();			this.isInPaintMethod = false;		//#endif	}