if ((subElements[j].getComponent()).equals(c))
MenuElement me = subElements[j]; if (me != null && (me.getComponent()).equals(c))
  public boolean isComponentPartOfCurrentMenu(Component c)  {    MenuElement[] subElements;    for (int i = 0; i < selectedPath.size(); i++)      {	subElements = ((MenuElement) selectedPath.get(i)).getSubElements();        for (int j = 0; j < subElements.length; j++)          {	    if ((subElements[j].getComponent()).equals(c))              return true;          }      }    return false;  }