当前位置: 首页>>代码示例>>Java>>正文


Java MenuPeer.delItem方法代码示例

本文整理汇总了Java中java.awt.peer.MenuPeer.delItem方法的典型用法代码示例。如果您正苦于以下问题:Java MenuPeer.delItem方法的具体用法?Java MenuPeer.delItem怎么用?Java MenuPeer.delItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.peer.MenuPeer的用法示例。


在下文中一共展示了MenuPeer.delItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: remove

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:Menu.java

示例2: remove

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Menu.java

示例3: remove

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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;
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:Menu.java

示例4: insert

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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));
    }

}
 
开发者ID:vilie,项目名称:javify,代码行数:47,代码来源:Menu.java

示例5: remove

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:Menu.java

示例6: insert

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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));
    }

}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:47,代码来源:Menu.java

示例7: remove

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:20,代码来源:Menu.java

示例8: remove

import java.awt.peer.MenuPeer; //导入方法依赖的package包/类
/**
    * 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);
    }
}
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:17,代码来源:Menu.java


注:本文中的java.awt.peer.MenuPeer.delItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。