Component c = ((MenuElement) event.getSource ()).getComponent (); if (selection.size () == 0)
MenuElement[] path = getPath(c); ((MenuElement) c).processMouseEvent(event, path, manager);   MenuElement[] subComponents = ((MenuElement) c).getSubElements();  for (int i = 0; i < subComponents.length; i++)
  public void processMouseEvent (MouseEvent event)  {        Component c = ((MenuElement) event.getSource ()).getComponent ();    if (selection.size () == 0)      {        ((MenuElement) event.getSource ()).processMouseEvent (event,                                                              getPath (c),                                                              manager);        return;      }    // find the index of the source component in the current menu hierarchy    int i = 0;    for (i = 0; i < selection.size (); i++)      {        MenuElement me = (MenuElement) selection.get (i);        if (me.getComponent ().equals (c))          break;      }    // Forward event to all subcomponents of the source     Component subComp;    for (int j = i; j < selection.size (); j++)      {         subComp = ((MenuElement)selection.get (j)).getComponent ();        ((MenuElement) selection.get (j)).processMouseEvent (event,                                                             getPath (subComp),                                                             manager);      }  }