jdk/src/share/classes/java/awt/Button.java

Print this page




 283         if (l == null) {
 284             return;
 285         }
 286         actionListener = AWTEventMulticaster.remove(actionListener, l);
 287     }
 288 
 289     /**
 290      * Returns an array of all the action listeners
 291      * registered on this button.
 292      *
 293      * @return all of this button's <code>ActionListener</code>s
 294      *         or an empty array if no action
 295      *         listeners are currently registered
 296      *
 297      * @see             #addActionListener
 298      * @see             #removeActionListener
 299      * @see             java.awt.event.ActionListener
 300      * @since 1.4
 301      */
 302     public synchronized ActionListener[] getActionListeners() {
 303         return (ActionListener[]) (getListeners(ActionListener.class));
 304     }
 305 
 306     /**
 307      * Returns an array of all the objects currently registered
 308      * as <code><em>Foo</em>Listener</code>s
 309      * upon this <code>Button</code>.
 310      * <code><em>Foo</em>Listener</code>s are registered using the
 311      * <code>add<em>Foo</em>Listener</code> method.
 312      *
 313      * <p>
 314      * You can specify the <code>listenerType</code> argument
 315      * with a class literal, such as
 316      * <code><em>Foo</em>Listener.class</code>.
 317      * For example, you can query a
 318      * <code>Button</code> <code>b</code>
 319      * for its action listeners with the following code:
 320      *
 321      * <pre>ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class));</pre>
 322      *
 323      * If no such listeners exist, this method returns an empty array.




 283         if (l == null) {
 284             return;
 285         }
 286         actionListener = AWTEventMulticaster.remove(actionListener, l);
 287     }
 288 
 289     /**
 290      * Returns an array of all the action listeners
 291      * registered on this button.
 292      *
 293      * @return all of this button's <code>ActionListener</code>s
 294      *         or an empty array if no action
 295      *         listeners are currently registered
 296      *
 297      * @see             #addActionListener
 298      * @see             #removeActionListener
 299      * @see             java.awt.event.ActionListener
 300      * @since 1.4
 301      */
 302     public synchronized ActionListener[] getActionListeners() {
 303         return getListeners(ActionListener.class);
 304     }
 305 
 306     /**
 307      * Returns an array of all the objects currently registered
 308      * as <code><em>Foo</em>Listener</code>s
 309      * upon this <code>Button</code>.
 310      * <code><em>Foo</em>Listener</code>s are registered using the
 311      * <code>add<em>Foo</em>Listener</code> method.
 312      *
 313      * <p>
 314      * You can specify the <code>listenerType</code> argument
 315      * with a class literal, such as
 316      * <code><em>Foo</em>Listener.class</code>.
 317      * For example, you can query a
 318      * <code>Button</code> <code>b</code>
 319      * for its action listeners with the following code:
 320      *
 321      * <pre>ActionListener[] als = (ActionListener[])(b.getListeners(ActionListener.class));</pre>
 322      *
 323      * If no such listeners exist, this method returns an empty array.