72 * // those that are interested in this event
73 * for (int i = listeners.length-2; i>=0; i-=2) {
74 * if (listeners[i]==FooListener.class) {
75 * // Lazily create the event:
76 * if (fooEvent == null)
77 * fooEvent = new FooEvent(this);
78 * ((FooListener)listeners[i+1]).fooXXX(fooEvent);
79 * }
80 * }
81 * }
82 * </pre>
83 * foo should be changed to the appropriate name, and fireFooXxx to the
84 * appropriate method name. One fire method should exist for each
85 * notification method in the FooListener interface.
86 * <p>
87 * <strong>Warning:</strong>
88 * Serialized objects of this class will not be compatible with
89 * future Swing releases. The current serialization support is
90 * appropriate for short term storage or RMI between applications running
91 * the same version of Swing. As of 1.4, support for long term storage
92 * of all JavaBeans™
93 * has been added to the <code>java.beans</code> package.
94 * Please see {@link java.beans.XMLEncoder}.
95 *
96 * @author Georges Saab
97 * @author Hans Muller
98 * @author James Gosling
99 */
100 @SuppressWarnings("serial")
101 public class EventListenerList implements Serializable {
102 /* A null array to be shared by all empty listener lists*/
103 private static final Object[] NULL_ARRAY = new Object[0];
104 /** The list of ListenerType - Listener pairs */
105 protected transient volatile Object[] listenerList = NULL_ARRAY;
106
107 /**
108 * Passes back the event listener list as an array
109 * of ListenerType-listener pairs. Note that for
110 * performance reasons, this implementation passes back
111 * the actual data structure in which the listener data
112 * is stored internally!
|
72 * // those that are interested in this event
73 * for (int i = listeners.length-2; i>=0; i-=2) {
74 * if (listeners[i]==FooListener.class) {
75 * // Lazily create the event:
76 * if (fooEvent == null)
77 * fooEvent = new FooEvent(this);
78 * ((FooListener)listeners[i+1]).fooXXX(fooEvent);
79 * }
80 * }
81 * }
82 * </pre>
83 * foo should be changed to the appropriate name, and fireFooXxx to the
84 * appropriate method name. One fire method should exist for each
85 * notification method in the FooListener interface.
86 * <p>
87 * <strong>Warning:</strong>
88 * Serialized objects of this class will not be compatible with
89 * future Swing releases. The current serialization support is
90 * appropriate for short term storage or RMI between applications running
91 * the same version of Swing. As of 1.4, support for long term storage
92 * of all JavaBeans
93 * has been added to the <code>java.beans</code> package.
94 * Please see {@link java.beans.XMLEncoder}.
95 *
96 * @author Georges Saab
97 * @author Hans Muller
98 * @author James Gosling
99 */
100 @SuppressWarnings("serial")
101 public class EventListenerList implements Serializable {
102 /* A null array to be shared by all empty listener lists*/
103 private static final Object[] NULL_ARRAY = new Object[0];
104 /** The list of ListenerType - Listener pairs */
105 protected transient volatile Object[] listenerList = NULL_ARRAY;
106
107 /**
108 * Passes back the event listener list as an array
109 * of ListenerType-listener pairs. Note that for
110 * performance reasons, this implementation passes back
111 * the actual data structure in which the listener data
112 * is stored internally!
|