openMenu( false ); System.out.println("letting menuContainer handle the selection,  open=" + this.menuOpened); } else if (this.menuSingleLeftCommand != null) { System.out.println("invoking single left command"); this.callCommandListener(this.menuSingleLeftCommand);
	public void pointerPressed(int x, int y) {		//#debug		System.out.println("PointerPressed at " + x + ", " + y );		try {			// check for scroll-indicator:			//#if !tmp.useScrollBar				//TODO support pointer events for scroll bar				if (  this.paintScrollIndicator &&						(x > this.scrollIndicatorX) &&						(y > this.scrollIndicatorY) &&						(x < this.scrollIndicatorX + this.scrollIndicatorWidth) &&						(y < this.scrollIndicatorY + this.scrollIndicatorWidth) ) 				{					//#debug					System.out.println("ScrollIndicator has been clicked... ");					// the scroll-indicator has been clicked:					int gameAction;					if ( (( !this.paintScrollIndicatorUp) || (y > this.scrollIndicatorY + this.scrollIndicatorWidth/2)) && this.paintScrollIndicatorDown) {						gameAction = Canvas.DOWN;					} else {						gameAction = Canvas.UP;					}					//#if tmp.menuFullScreen						//#ifdef tmp.useExternalMenuBar							if (this.menuBar.isOpened) {								this.menuBar.handleKeyPressed( 0, gameAction );							} else {								handleKeyPressed( 0, gameAction );							}						//#else							if (this.menuOpened) {								this.menuContainer.handleKeyPressed( 0, gameAction );							} else {								handleKeyPressed( 0, gameAction );							}						//#endif					//#else						handleKeyPressed( 0, gameAction );					//#endif					repaint();					return;				}			//#endif			//#ifdef tmp.menuFullScreen				//#ifdef tmp.useExternalMenuBar					if (this.menuBar.handlePointerPressed(x, y)) {						repaint();						return;					}				//#else					// check if one of the command buttons has been pressed:					if (y > this.screenHeight) {						if (x >= this.menuRightCommandX && this.menuRightCommandX != 0) {							if (this.menuOpened) {								openMenu( false );							} else if (this.menuSingleRightCommand != null) {								callCommandListener(this.menuSingleRightCommand );							}							repaint();							return;						} else if (x <= this.menuLeftCommandX){							// assume that the left command has been pressed:							if (this.menuSingleLeftCommand != null) {								this.callCommandListener(this.menuSingleLeftCommand);							} else if (this.menuOpened ) {								// the "SELECT" command has been clicked:								this.menuContainer.handleKeyPressed(0, Canvas.FIRE);//								int focusedIndex = this.menuContainer.getFocusedIndex();//								Command cmd = (Command) this.menuCommands.get( focusedIndex );//								callCommandListener( cmd );						//								this.menuOpened = false;//								//#if !polish.MenuBar.focusFirstAfterClose//									// focus the first item again, so when the user opens the menu again, it will be "fresh" again//									this.menuContainer.focus(0);//								//#endif							} else {								openMenu( true );								//this.menuOpened = true;							}							repaint();							return;						}					} else if (this.menuOpened) {						openMenu( false );						// a menu-item could have been selected:						if (this.menuContainer.handlePointerPressed( x, y )) {							//TODO add support for pointer events and sub commands							int focusedIndex = this.menuContainer.getFocusedIndex();							Command cmd = (Command) this.menuCommands.get( focusedIndex );							callCommandListener( cmd );												} else {							//#ifdef tmp.useTitle								//y -= this.titleHeight;							//#endif							int focusedIndex = this.menuContainer.getFocusedIndex();							Item item = this.menuContainer.get( focusedIndex );							if (y > item.yTopPos  && y < item.yBottomPos									&& x > item.xLeftPos && x < item.xRightPos) {								Command cmd = (Command) this.menuCommands.get( focusedIndex );								callCommandListener( cmd );								}						}						repaint();						return;					}				//#endif			//#endif			// let the screen handle the pointer pressing:			//#ifdef tmp.usingTitle				//boolean processed = handlePointerPressed( x, y - (this.titleHeight + this.infoHeight + this.subTitleHeight) );				boolean processed = handlePointerPressed( x, y  );				if (processed) {					notifyScreenStateChanged();					repaint();				}			//#else				//# boolean processed = handlePointerPressed( x, y );				if (processed) {					repaint();				}			//#endif						//#ifdef polish.debug.debug				if (!processed) {					System.out.println("PointerPressed at " + x + ", " + y + " not processed.");									}			//#endif		} catch (Exception e) {			//#debug error			System.out.println("PointerPressed at " + x + "," + y + " resulted in exception" + e );		} finally {			this.isScreenChangeDirtyFlag = false;		}	}