Exemplo n.º 1
0
 /**
  * Inserts a menu item for the specified <code>Action</code> object at a given position.
  *
  * @param a the <code>Action</code> object to insert
  * @param index specifies the position at which to insert the <code>Action</code>, where 0 is the
  *     first
  * @exception IllegalArgumentException if <code>index</code> < 0
  * @see Action
  */
 public void insert(Action a, int index) {
   JMenuItem mi = createActionComponent(a);
   mi.setAction(a);
   insert(mi, index);
 }
Exemplo n.º 2
0
 /**
  * Appends a new menu item to the end of the menu which dispatches the specified <code>Action
  * </code> object.
  *
  * @param a the <code>Action</code> to add to the menu
  * @return the new menu item
  * @see Action
  */
 public JMenuItem add(Action a) {
   JMenuItem mi = createActionComponent(a);
   mi.setAction(a);
   add(mi);
   return mi;
 }