if (index < 0) throw new IllegalArgumentException("index less than 0");
  public JMenuItem getItem(int index)  {    Component c = popupMenu.getComponentAtIndex(index);    if (c instanceof JMenuItem)      return (JMenuItem) c;    else      return null;  }