boolean hasToolbarButton(AbstractButton rb) {
		if (!EventQueue.isDispatchThread())
			throw new RuntimeException("must be called by the event thread.");
		if (rb == null)
			return false;
		int n = getToolBar().getComponentCount();
		if (n == 0)
			return false;
		Component c = null;
		for (int i = 0; i < n; i++) {
			c = getToolBar().getComponent(i);
			if (c == rb)
				return true;
		}
		if (expandMenu != null) {
			n = expandMenu.getComponentCount();
			if (n == 0)
				return false;
			for (int i = 0; i < n; i++) {
				c = expandMenu.getComponent(i);
				if (c == rb)
					return true;
			}
		}
		return false;
	}