/** * Removes the menu item at the specified index from this menu. * * @param pos the position of the item to be removed * @exception IllegalArgumentException if the value of <code>pos</code> < 0, or if <code>pos * </code> is greater than the number of menu items */ @Override public void remove(int pos) { if (pos < 0) { throw new IllegalArgumentException("index less than zero."); } if (pos > getItemCount()) { throw new IllegalArgumentException("index greater than the number of items."); } if (popupMenu != null) popupMenu.remove(pos); }
/** * Removes the component <code>c</code> from this menu. * * @param c the component to be removed */ @Override public void remove(Component c) { if (popupMenu != null) popupMenu.remove(c); }
/** * Removes the specified menu item from this menu. If there is no popup menu, this method will * have no effect. * * @param item the <code>JMenuItem</code> to be removed from the menu */ @Override public void remove(JMenuItem item) { if (popupMenu != null) popupMenu.remove(item); }