y = this.titleHeight;
y = tHeight;
	public final void paint(Graphics g) {		//#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.showInfoItem) {				this.infoItem.paint( 0, tHeight, 0, this.screenWidth, g );				tHeight += this.infoItem.itemHeight;			}			// 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				if (this.menuOpened) {					int menuHeight = this.menuContainer.getItemHeight(this.menuMaxWidth, this.menuMaxWidth);					int y = this.originalScreenHeight - menuHeight;					if (y < this.titleHeight) {						this.paintScrollIndicator = true;						this.paintScrollIndicatorUp = (this.menuContainer.yOffset != 0);						this.paintScrollIndicatorDown = (this.menuContainer.yOffset + menuHeight > this.screenHeight - this.titleHeight);						y = this.titleHeight; 						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 );						g.drawString(menuText, 2, this.originalScreenHeight + 2, Graphics.TOP | Graphics.LEFT );						if ( this.menuOpened ) {							// draw cancel string:							//#ifdef polish.command.cancel:defined								//#= menuText = "${polish.command.cancel}";							//#else								menuText = "Cancel";							//#endif							g.drawString(menuText, this.screenWidth - 2, this.originalScreenHeight + 2, Graphics.TOP | Graphics.RIGHT );							//#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();						g.drawString(menuText, this.screenWidth - 2, this.originalScreenHeight + 2, Graphics.TOP | Graphics.RIGHT );						//#ifdef polish.hasPointerEvents							this.menuRightCommandX = this.screenWidth - 2 								- this.menuFont.stringWidth( menuText );						//#endif					}				} // if this.showTitleOrMenu || this.menuOpened			//#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.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	}