Java 类java.awt.peer.MenuPeer 实例源码

项目:OpenJSharp    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:jdk8u-jdk    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:openjdk-jdk10    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:openjdk9    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:Java8CN    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:jdk8u_jdk    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:javify    文件:Menu.java   
/**
 * Adds the specified item to this menu.  If it was previously part of
 * another menu, it is first removed from that menu.
 *
 * @param item The new item to add.
 *
 * @return The item that was added.
 */
public MenuItem add(MenuItem item)
{
  MenuContainer parent = item.getParent();
  if (parent != null)
    parent.remove(item);

  items.addElement(item);
  item.setParent(this);

  if (peer != null)
    {
      item.addNotify();
      MenuPeer mp = (MenuPeer) peer;
      mp.addItem(item);
    }

  return item;
}
项目:javify    文件:Menu.java   
/**
 * Creates the native peer for this object.
 */
public void addNotify()
{
  MenuPeer peer = (MenuPeer) getPeer();
  if (peer == null)
    {
      peer = getToolkit().createMenu(this);
      setPeer(peer);
    }

  Enumeration e = items.elements();
  while (e.hasMoreElements())
  {
    MenuItem mi = (MenuItem)e.nextElement();
    mi.addNotify();
    peer.addItem(mi);
  }

  super.addNotify();
}
项目:jvm-stm    文件:Menu.java   
/**
 * Adds the specified item to this menu.  If it was previously part of
 * another menu, it is first removed from that menu.
 *
 * @param item The new item to add.
 *
 * @return The item that was added.
 */
public MenuItem add(MenuItem item)
{
  MenuContainer parent = item.getParent();
  if (parent != null)
    parent.remove(item);

  items.addElement(item);
  item.setParent(this);

  if (peer != null)
    {
      item.addNotify();
      MenuPeer mp = (MenuPeer) peer;
      mp.addItem(item);
    }

  return item;
}
项目:jvm-stm    文件:Menu.java   
/**
 * Creates the native peer for this object.
 */
public void addNotify()
{
  MenuPeer peer = (MenuPeer) getPeer();
  if (peer == null)
    {
      peer = getToolkit().createMenu(this);
      setPeer(peer);
    }

  Enumeration e = items.elements();
  while (e.hasMoreElements())
  {
    MenuItem mi = (MenuItem)e.nextElement();
    mi.addNotify();
    peer.addItem(mi);
  }

  super.addNotify();
}
项目:VarJ    文件:Menu.java   
/**
    * Adds the specified menu item to this menu. If the
    * menu item has been part of another menu, removes it
    * from that menu.
    *
    * @param       mi   the menu item to be added
    * @return      the menu item added
    * @see         java.awt.Menu#insert(java.lang.String, int)
    * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
    */
   public MenuItem add(MenuItem mi) {
       synchronized (getTreeLock()) {
    if (mi.parent != null) {
        mi.parent.remove(mi);
    }
    items.addElement(mi);
    mi.parent = this;
    MenuPeer peer = (MenuPeer)this.peer;
    if (peer != null) {
        mi.addNotify();
    peer.addItem(mi);
    }
    return mi;
}
   }
项目:jdk-1.7-annotated    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:infobip-open-jdk-8    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:jdk8u-dev-jdk    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:jdk7-jdk    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:openjdk-source-code-learn    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:OLD-OpenJDK8    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:JamVM-PH    文件:Menu.java   
/**
 * Adds the specified item to this menu.  If it was previously part of
 * another menu, it is first removed from that menu.
 *
 * @param item The new item to add.
 *
 * @return The item that was added.
 */
public MenuItem add(MenuItem item)
{
  MenuContainer parent = item.getParent();
  if (parent != null)
    parent.remove(item);

  items.addElement(item);
  item.setParent(this);

  if (peer != null)
    {
      item.addNotify();
      MenuPeer mp = (MenuPeer) peer;
      mp.addItem(item);
    }

  return item;
}
项目:JamVM-PH    文件:Menu.java   
/**
 * Creates the native peer for this object.
 */
public void addNotify()
{
  MenuPeer peer = (MenuPeer) getPeer();
  if (peer == null)
    {
      peer = getToolkit().createMenu(this);
      setPeer(peer);
    }

  Enumeration e = items.elements();
  while (e.hasMoreElements())
  {
    MenuItem mi = (MenuItem)e.nextElement();
    mi.addNotify();
    peer.addItem(mi);
  }

  super.addNotify();
}
项目:openjdk-jdk7u-jdk    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:classpath    文件:Menu.java   
/**
 * Adds the specified item to this menu.  If it was previously part of
 * another menu, it is first removed from that menu.
 *
 * @param item The new item to add.
 *
 * @return The item that was added.
 */
public MenuItem add(MenuItem item)
{
  MenuContainer parent = item.getParent();
  if (parent != null)
    parent.remove(item);

  items.addElement(item);
  item.setParent(this);

  if (peer != null)
    {
      item.addNotify();
      MenuPeer mp = (MenuPeer) peer;
      mp.addItem(item);
    }

  return item;
}
项目:classpath    文件:Menu.java   
/**
 * Creates the native peer for this object.
 */
public void addNotify()
{
  MenuPeer peer = (MenuPeer) getPeer();
  if (peer == null)
    {
      peer = getToolkit().createMenu(this);
      setPeer(peer);
    }

  Enumeration e = items.elements();
  while (e.hasMoreElements())
  {
    MenuItem mi = (MenuItem)e.nextElement();
    mi.addNotify();
    peer.addItem(mi);
  }

  super.addNotify();
}
项目:openjdk-icedtea7    文件:Menu.java   
/**
 * Adds the specified menu item to this menu. If the
 * menu item has been part of another menu, removes it
 * from that menu.
 *
 * @param       mi   the menu item to be added
 * @return      the menu item added
 * @see         java.awt.Menu#insert(java.lang.String, int)
 * @see         java.awt.Menu#insert(java.awt.MenuItem, int)
 */
public MenuItem add(MenuItem mi) {
    synchronized (getTreeLock()) {
        if (mi.parent != null) {
            mi.parent.remove(mi);
        }
        items.addElement(mi);
        mi.parent = this;
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.addNotify();
            peer.addItem(mi);
        }
        return mi;
    }
}
项目:OpenJSharp    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:jdk8u-jdk    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:openjdk-jdk10    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            peer.delItem(index);
            mi.removeNotify();
        }
        mi.parent = null;
    }
}
项目:openjdk9    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            peer.delItem(index);
            mi.removeNotify();
            mi.parent = null;
        }
    }
}
项目:Java8CN    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:jdk8u_jdk    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            peer.delItem(index);
            mi.removeNotify();
            mi.parent = null;
        }
    }
}
项目:javify    文件:Menu.java   
/**
 * Inserts the specified menu item into this menu at the specified index.  If
 * the index is greater than or equal to the number of items already in the
 * menu, the new item is added as the last item in the menu.
 *
 * @param item The menu item to add (<code>null</code> not permitted).
 * @param index The index of the menu item (>= 0).
 *
 * @throws IllegalArgumentException if the index is less than zero.
 * @throws NullPointerException if <code>item</code> is <code>null</code>.
 */
public void insert(MenuItem item, int index)
{
  if (index < 0)
    throw new IllegalArgumentException("Index is less than zero");

  int count = getItemCount();

  if (index >= count)
    add(item);
  else
    {
      MenuContainer parent = item.getParent();
      if (parent != null)
        parent.remove(item);

      items.insertElementAt(item, index);
      item.setParent(this);

      MenuPeer peer = (MenuPeer) getPeer();
      if (peer == null)
        return;

      for (int i = count - 1; i >= index; i--)
        peer.delItem(i);

      item.addNotify();
      peer.addItem(item);

      // bear in mind that count is the number of items *before* the new
      // item was added
      for (int i = index + 1; i <= count; i++)
        peer.addItem((MenuItem) items.elementAt(i));
    }

}
项目:javify    文件:Menu.java   
/**
 * Deletes the item at the specified index from this menu.
 *
 * @param index The index of the item to remove.
 *
 * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
 */
public synchronized void remove(int index)
{
  MenuItem item = (MenuItem) items.remove(index);

  MenuPeer mp = (MenuPeer) getPeer();
  if (mp != null)
    {
      mp.delItem(index);
      item.removeNotify();
    }
  item.setParent(null);
}
项目:jvm-stm    文件:Menu.java   
/**
 * Inserts the specified menu item into this menu at the specified index.  If
 * the index is greater than or equal to the number of items already in the
 * menu, the new item is added as the last item in the menu.
 *
 * @param item The menu item to add (<code>null</code> not permitted).
 * @param index The index of the menu item (>= 0).
 *
 * @throws IllegalArgumentException if the index is less than zero.
 * @throws NullPointerException if <code>item</code> is <code>null</code>.
 */
public void insert(MenuItem item, int index)
{
  if (index < 0)
    throw new IllegalArgumentException("Index is less than zero");

  int count = getItemCount();

  if (index >= count)
    add(item);
  else
    {
      MenuContainer parent = item.getParent();
      if (parent != null)
        parent.remove(item);

      items.insertElementAt(item, index);
      item.setParent(this);

      MenuPeer peer = (MenuPeer) getPeer();
      if (peer == null)
        return;

      for (int i = count - 1; i >= index; i--)
        peer.delItem(i);

      item.addNotify();
      peer.addItem(item);

      // bear in mind that count is the number of items *before* the new
      // item was added
      for (int i = index + 1; i <= count; i++)
        peer.addItem((MenuItem) items.elementAt(i));
    }

}
项目:jvm-stm    文件:Menu.java   
/**
 * Deletes the item at the specified index from this menu.
 *
 * @param index The index of the item to remove.
 * 
 * @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
 */
public synchronized void remove(int index)
{
  MenuItem item = (MenuItem) items.remove(index);

  MenuPeer mp = (MenuPeer) getPeer();
  if (mp != null)
    {
      mp.delItem(index);
      item.removeNotify();
    }
  item.setParent(null);
}
项目:VarJ    文件:Menu.java   
/**
    * Removes the menu item at the specified index from this menu.
    * @param       index the position of the item to be removed.
    */
   public void remove(int index) {
       synchronized (getTreeLock()) {
    MenuItem mi = getItem(index);
    items.removeElementAt(index);
    MenuPeer peer = (MenuPeer)this.peer;
    if (peer != null) {
        mi.removeNotify();
    mi.parent = null;
    peer.delItem(index);
    }
}
   }
项目:jdk-1.7-annotated    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:infobip-open-jdk-8    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:jdk8u-dev-jdk    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}
项目:jdk7-jdk    文件:Menu.java   
/**
 * Removes the menu item at the specified index from this menu.
 * @param       index the position of the item to be removed.
 */
public void remove(int index) {
    synchronized (getTreeLock()) {
        MenuItem mi = getItem(index);
        items.removeElementAt(index);
        MenuPeer peer = (MenuPeer)this.peer;
        if (peer != null) {
            mi.removeNotify();
            mi.parent = null;
            peer.delItem(index);
        }
    }
}