![]() ![]()
|
22
Listener List
Features of JCListenerList
Classes
Examples
22.1 Features of JCListenerList
JCListenerListis a class that assists with keeping track of event listeners in a thread-safe manner. The use of static methods on theJCListenerListclass prevents any problems from occurring if the list being modified is null. To send events to the listener in the list, simply get theJCListenerListEnumerationof the list and walk through the elements. There is no ordering guarantee.
22.2 Classes
The following is a list of the
JCListenerListclasses:
Implements
java.util.Enumerationand takes aJCListenerListas its parameter. It defines methodshasMoreElements()andnextElement().
22.3 Methods
The following is a list of the
JCListenerListmethods:
22.4 Examples
To add a listener using a
JCListenerList someList = null;JCListenerList:
...
public synchronized void addSomeListener(SomeListener l) {
someList = JCListenerList.add(someList, l);
}
public synchronized void removeSomeListener(SomeListener l) {
someList = JCListenerList.remove(someList, l);
}The use of static methods on the
JCListenerListclass prevents any problems from occurring if the list being modified is null.To send events to the listener in the list, simply get the
Enumerationof the list and walk through the elements. There is no ordering guarantee.
![]() ![]()
|