458 *
459 * @param l the action listener to be removed
460 */
461 public synchronized void removeActionListener(ActionListener l) {
462 if ((l != null) && (getAction() == l)) {
463 setAction(null);
464 } else {
465 listenerList.remove(ActionListener.class, l);
466 }
467 }
468
469 /**
470 * Returns an array of all the <code>ActionListener</code>s added
471 * to this JTextField with addActionListener().
472 *
473 * @return all of the <code>ActionListener</code>s added or an empty
474 * array if no listeners have been added
475 * @since 1.4
476 */
477 public synchronized ActionListener[] getActionListeners() {
478 return (ActionListener[])listenerList.getListeners(
479 ActionListener.class);
480 }
481
482 /**
483 * Notifies all listeners that have registered interest for
484 * notification on this event type. The event instance
485 * is lazily created.
486 * The listener list is processed in last to
487 * first order.
488 * @see EventListenerList
489 */
490 protected void fireActionPerformed() {
491 // Guaranteed to return a non-null array
492 Object[] listeners = listenerList.getListenerList();
493 int modifiers = 0;
494 AWTEvent currentEvent = EventQueue.getCurrentEvent();
495 if (currentEvent instanceof InputEvent) {
496 modifiers = ((InputEvent)currentEvent).getModifiers();
497 } else if (currentEvent instanceof ActionEvent) {
498 modifiers = ((ActionEvent)currentEvent).getModifiers();
499 }
|
458 *
459 * @param l the action listener to be removed
460 */
461 public synchronized void removeActionListener(ActionListener l) {
462 if ((l != null) && (getAction() == l)) {
463 setAction(null);
464 } else {
465 listenerList.remove(ActionListener.class, l);
466 }
467 }
468
469 /**
470 * Returns an array of all the <code>ActionListener</code>s added
471 * to this JTextField with addActionListener().
472 *
473 * @return all of the <code>ActionListener</code>s added or an empty
474 * array if no listeners have been added
475 * @since 1.4
476 */
477 public synchronized ActionListener[] getActionListeners() {
478 return listenerList.getListeners(ActionListener.class);
479 }
480
481 /**
482 * Notifies all listeners that have registered interest for
483 * notification on this event type. The event instance
484 * is lazily created.
485 * The listener list is processed in last to
486 * first order.
487 * @see EventListenerList
488 */
489 protected void fireActionPerformed() {
490 // Guaranteed to return a non-null array
491 Object[] listeners = listenerList.getListenerList();
492 int modifiers = 0;
493 AWTEvent currentEvent = EventQueue.getCurrentEvent();
494 if (currentEvent instanceof InputEvent) {
495 modifiers = ((InputEvent)currentEvent).getModifiers();
496 } else if (currentEvent instanceof ActionEvent) {
497 modifiers = ((ActionEvent)currentEvent).getModifiers();
498 }
|