src/share/classes/java/awt/MenuItem.java

Print this page




 547             return;
 548         }
 549         actionListener = AWTEventMulticaster.remove(actionListener, l);
 550     }
 551 
 552     /**
 553      * Returns an array of all the action listeners
 554      * registered on this menu item.
 555      *
 556      * @return all of this menu item's <code>ActionListener</code>s
 557      *         or an empty array if no action
 558      *         listeners are currently registered
 559      *
 560      * @see        #addActionListener
 561      * @see        #removeActionListener
 562      * @see        java.awt.event.ActionEvent
 563      * @see        java.awt.event.ActionListener
 564      * @since 1.4
 565      */
 566     public synchronized ActionListener[] getActionListeners() {
 567         return (ActionListener[])(getListeners(ActionListener.class));
 568     }
 569 
 570     /**
 571      * Returns an array of all the objects currently registered
 572      * as <code><em>Foo</em>Listener</code>s
 573      * upon this <code>MenuItem</code>.
 574      * <code><em>Foo</em>Listener</code>s are registered using the
 575      * <code>add<em>Foo</em>Listener</code> method.
 576      *
 577      * <p>
 578      * You can specify the <code>listenerType</code> argument
 579      * with a class literal, such as
 580      * <code><em>Foo</em>Listener.class</code>.
 581      * For example, you can query a
 582      * <code>MenuItem</code> <code>m</code>
 583      * for its action listeners with the following code:
 584      *
 585      * <pre>ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));</pre>
 586      *
 587      * If no such listeners exist, this method returns an empty array.




 547             return;
 548         }
 549         actionListener = AWTEventMulticaster.remove(actionListener, l);
 550     }
 551 
 552     /**
 553      * Returns an array of all the action listeners
 554      * registered on this menu item.
 555      *
 556      * @return all of this menu item's <code>ActionListener</code>s
 557      *         or an empty array if no action
 558      *         listeners are currently registered
 559      *
 560      * @see        #addActionListener
 561      * @see        #removeActionListener
 562      * @see        java.awt.event.ActionEvent
 563      * @see        java.awt.event.ActionListener
 564      * @since 1.4
 565      */
 566     public synchronized ActionListener[] getActionListeners() {
 567         return getListeners(ActionListener.class);
 568     }
 569 
 570     /**
 571      * Returns an array of all the objects currently registered
 572      * as <code><em>Foo</em>Listener</code>s
 573      * upon this <code>MenuItem</code>.
 574      * <code><em>Foo</em>Listener</code>s are registered using the
 575      * <code>add<em>Foo</em>Listener</code> method.
 576      *
 577      * <p>
 578      * You can specify the <code>listenerType</code> argument
 579      * with a class literal, such as
 580      * <code><em>Foo</em>Listener.class</code>.
 581      * For example, you can query a
 582      * <code>MenuItem</code> <code>m</code>
 583      * for its action listeners with the following code:
 584      *
 585      * <pre>ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));</pre>
 586      *
 587      * If no such listeners exist, this method returns an empty array.