예제 #1
0
 protected void fireCaretEvent() {
   Object[] listeners = listenerList.getListenerList();
   for (int i = listeners.length - 2; i >= 0; i--) {
     if (listeners[i] == CaretListener.class) {
       ((CaretListener) listeners[i + 1]).caretUpdate(caretEvent);
     }
   }
 }
예제 #2
0
 protected void fireEditingStopped() {
   Object[] listeners = listenerList.getListenerList();
   // Process the listeners last to first, notifying
   // those that are interested in this event
   for (int i = listeners.length - 2; i >= 0; i -= 2) {
     if (listeners[i] == CellEditorListener.class) {
       // Lazily create the event:
       if (changeEvent == null) changeEvent = new ChangeEvent(this);
       ((CellEditorListener) listeners[i + 1]).editingStopped(changeEvent);
     }
   }
 }
예제 #3
0
 protected void fireFocusGained(boolean temporary) {
   FocusEvent foo = new FocusEvent(this, this.getID(), temporary);
   // Guaranteed to return a non-null array
   Object[] listeners = listenerList.getListenerList();
   // Process the listeners last to first, notifying
   // those that are interested in this event
   for (int i = listeners.length - 2; i >= 0; i -= 2) {
     if (listeners[i] == FocusListener.class) {
       ((FocusListener) listeners[i + 1]).focusGained(foo);
     }
   }
 }
 /**
  * Notifies all listeners that have registered interest for notification on this event type. The
  * event instance is created lazily.
  *
  * @see EventListenerList
  */
 protected void fireStateChanged() {
   // Guaranteed to return a non-null array
   Object[] listeners = listenerList.getListenerList();
   // Process the listeners last to first, notifying
   // those that are interested in this event
   for (int i = listeners.length - 2; i >= 0; i -= 2) {
     if (listeners[i] == ChangeListener.class) {
       // Lazily create the event:
       if (changeEvent == null) changeEvent = new ChangeEvent(this);
       ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);
     }
   }
 }
예제 #5
0
  protected void fireActionPerformed(String command) {
    ActionEvent foo = new ActionEvent(this, this.getID(), command);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();

    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
      if (listeners[i] == ActionListener.class) {
        ((ActionListener) listeners[i + 1]).actionPerformed(foo);
      }
    }
  }
 /**
  * Notifies all listeners that have registered interest for notification on this event type.
  *
  * @param e the <code>ActionEvent</code> to deliver to listeners
  * @see EventListenerList
  */
 protected void fireActionPerformed(ActionEvent e) {
   // Guaranteed to return a non-null array
   Object[] listeners = listenerList.getListenerList();
   // Process the listeners last to first, notifying
   // those that are interested in this event
   for (int i = listeners.length - 2; i >= 0; i -= 2) {
     if (listeners[i] == ActionListener.class) {
       // Lazily create the event:
       // if (changeEvent == null)
       // changeEvent = new ChangeEvent(this);
       ((ActionListener) listeners[i + 1]).actionPerformed(e);
     }
   }
 }
 /**
  * Returns an array of all the action listeners registered on this <code>DefaultButtonModel</code>
  * .
  *
  * @return all of this model's <code>ActionListener</code>s or an empty array if no action
  *     listeners are currently registered
  * @see #addActionListener
  * @see #removeActionListener
  * @since 1.4
  */
 public ActionListener[] getActionListeners() {
   return (ActionListener[]) listenerList.getListeners(ActionListener.class);
 }
 /** {@inheritDoc} */
 public void removeActionListener(ActionListener l) {
   listenerList.remove(ActionListener.class, l);
 }
 /** {@inheritDoc} */
 public void addActionListener(ActionListener l) {
   listenerList.add(ActionListener.class, l);
 }
예제 #10
0
 public void removeActionListener(ActionListener listener) {
   if (listenerList != null) {
     listenerList.remove(ActionListener.class, listener);
   }
 }
 /**
  * Returns an array of all the objects currently registered as <code><em>Foo</em>Listener</code>s
  * upon this model. <code><em>Foo</em>Listener</code>s are registered using the <code>
  * add<em>Foo</em>Listener</code> method.
  *
  * <p>You can specify the <code>listenerType</code> argument with a class literal, such as <code>
  * <em>Foo</em>Listener.class</code>. For example, you can query a <code>DefaultButtonModel</code>
  * instance <code>m</code> for its action listeners with the following code:
  *
  * <pre>ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));</pre>
  *
  * If no such listeners exist, this method returns an empty array.
  *
  * @param listenerType the type of listeners requested; this parameter should specify an interface
  *     that descends from <code>java.util.EventListener</code>
  * @return an array of all objects registered as <code><em>Foo</em>Listener</code>s on this model,
  *     or an empty array if no such listeners have been added
  * @exception ClassCastException if <code>listenerType</code> doesn't specify a class or interface
  *     that implements <code>java.util.EventListener</code>
  * @see #getActionListeners
  * @see #getChangeListeners
  * @see #getItemListeners
  * @since 1.3
  */
 public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
   return listenerList.getListeners(listenerType);
 }
 /** {@inheritDoc} */
 public void removeItemListener(ItemListener l) {
   listenerList.remove(ItemListener.class, l);
 }
예제 #13
0
 public void removeCellEditorListener(CellEditorListener l) {
   listenerList.remove(CellEditorListener.class, l);
 }
예제 #14
0
 public void addCellEditorListener(CellEditorListener l) {
   listenerList.add(CellEditorListener.class, l);
 }
예제 #15
0
 public void removeFocusListener(FocusListener listener) {
   if (listenerList != null) {
     listenerList.remove(FocusListener.class, listener);
   }
 }
예제 #16
0
 public void addFocusListener(FocusListener listener) {
   if (listenerList != null) {
     listenerList.add(FocusListener.class, listener);
   }
 }
 /** {@inheritDoc} */
 public void addItemListener(ItemListener l) {
   listenerList.add(ItemListener.class, l);
 }
 /** {@inheritDoc} */
 public void addChangeListener(ChangeListener l) {
   listenerList.add(ChangeListener.class, l);
 }
 /**
  * Returns an array of all the item listeners registered on this <code>DefaultButtonModel</code>.
  *
  * @return all of this model's <code>ItemListener</code>s or an empty array if no item listeners
  *     are currently registered
  * @see #addItemListener
  * @see #removeItemListener
  * @since 1.4
  */
 public ItemListener[] getItemListeners() {
   return (ItemListener[]) listenerList.getListeners(ItemListener.class);
 }
 /** {@inheritDoc} */
 public void removeChangeListener(ChangeListener l) {
   listenerList.remove(ChangeListener.class, l);
 }
 /**
  * Returns an array of all the change listeners registered on this <code>DefaultButtonModel</code>
  * .
  *
  * @return all of this model's <code>ChangeListener</code>s or an empty array if no change
  *     listeners are currently registered
  * @see #addChangeListener
  * @see #removeChangeListener
  * @since 1.4
  */
 public ChangeListener[] getChangeListeners() {
   return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
 }
예제 #22
0
 public void addActionListener(ActionListener listener) {
   if (listenerList != null) {
     listenerList.add(ActionListener.class, listener);
   }
 }