Example #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);
     }
   }
 }
 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);
     }
   }
 }
Example #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 lazily created using the parameters passed into the fire method.
  *
  * @see EventListenerList
  */
 protected void fireColumnMarginChanged() {
   // 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] == TableColumnModelListener.class) {
       // Lazily create the event:
       if (changeEvent == null) changeEvent = new ChangeEvent(this);
       ((TableColumnModelListener) listeners[i + 1]).columnMarginChanged(changeEvent);
     }
   }
 }
Example #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);
      }
    }
  }
 public void removeCellEditorListener(CellEditorListener l) {
   listenerList.remove(CellEditorListener.class, l);
 }
 public void addCellEditorListener(CellEditorListener l) {
   listenerList.add(CellEditorListener.class, l);
 }
 /**
  * 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>DefaultTableColumnModel
  * </code> <code>m</code> for its column model listeners with the following code:
  *
  * <pre>
  * ColumnModelListener[] cmls = (ColumnModelListener[])(m.getListeners(ColumnModelListener.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 #getColumnModelListeners
  * @since 1.3
  */
 public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
   return listenerList.getListeners(listenerType);
 }
 /**
  * Returns an array of all the column model listeners registered on this model.
  *
  * @return all of this default table column model's <code>ColumnModelListener</code>s or an empty
  *     array if no column model listeners are currently registered
  * @see #addColumnModelListener
  * @see #removeColumnModelListener
  * @since 1.4
  */
 public TableColumnModelListener[] getColumnModelListeners() {
   return (TableColumnModelListener[]) listenerList.getListeners(TableColumnModelListener.class);
 }
 /**
  * Removes a listener for table column model events.
  *
  * @param x a <code>TableColumnModelListener</code> object
  */
 public void removeColumnModelListener(TableColumnModelListener x) {
   listenerList.remove(TableColumnModelListener.class, x);
 }
 /**
  * Adds a listener for table column model events.
  *
  * @param x a <code>TableColumnModelListener</code> object
  */
 public void addColumnModelListener(TableColumnModelListener x) {
   listenerList.add(TableColumnModelListener.class, x);
 }
Example #12
0
 public void removeFocusListener(FocusListener listener) {
   if (listenerList != null) {
     listenerList.remove(FocusListener.class, listener);
   }
 }
Example #13
0
 public void addFocusListener(FocusListener listener) {
   if (listenerList != null) {
     listenerList.add(FocusListener.class, listener);
   }
 }
Example #14
0
 public void removeActionListener(ActionListener listener) {
   if (listenerList != null) {
     listenerList.remove(ActionListener.class, listener);
   }
 }
Example #15
0
 public void addActionListener(ActionListener listener) {
   if (listenerList != null) {
     listenerList.add(ActionListener.class, listener);
   }
 }