public void setPopupMenuVisible(boolean b) {
   		if (!b) {
			super.setPopupMenuVisible(b);
			return;
			}
		boolean isVisible = isPopupMenuVisible();
		if (isVisible)
			return;
	 	
	   	if (fPopupMenu == null) {
			fPopupMenu = getPopupMenu();
			fPopupMenuSize = fPopupMenu.getPreferredSize();
			}

		if (isShowing()) {
			int	x = 0;
			int	y = 0;
			Dimension 	menuSize 		= getSize();
			Point		menuLocation 	= getLocationOnScreen();
			if (getParent() instanceof JPopupMenu) {
				if ((menuLocation.x + menuSize.width + fPopupMenuSize.width) > kScreenSize.width)
					x = -fPopupMenuSize.width;
			   	else
					x = menuSize.width;

			  	if ((menuLocation.y + fPopupMenuSize.height + kWindowsBarHeightOffset) > kScreenSize.height)
					y = kScreenSize.height - (menuLocation.y + fPopupMenuSize.height + kWindowsBarHeightOffset);
			  	else
					y = 0;
		 	} else {
				if ((menuLocation.x + fPopupMenuSize.width) > kScreenSize.width)
					x = kScreenSize.width - (menuLocation.x + fPopupMenuSize.width);
			  	else
					x = 0;

				y = menuSize.height;
		   	}

			fPopupMenu.show(this, x, y);
		}
	}