All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----jclass.util.JCListenerList
JCListenerList
is a class that assists with
keeping track of event listeners in a thread-safe manner.
To add a listener using a JCListenerList
:
JCListenerList someList = null; ... public synchronized void addSomeListener(SomeListener l) { someList = JCListenerList.add(someList, l); }To remove a listener:
public synchronized void removeSomeListener(SomeListener l) { someList = JCListenerList.remove(someList, l); }The use of static methods on the
JCListenerList
class prevents any
problems from occuring should the list being modified be null.
To send events to the listener in the list, simply get the
Enumeration of the list and walk through the elements.
There is no ordering guarantee.
public static JCListenerList add(JCListenerList list, Object newListener)
public static JCListenerList remove(JCListenerList list, Object oldListener)
public static Enumeration elements(JCListenerList list)
All Packages Class Hierarchy This Package Previous Next Index