All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.util.JCListenerList

java.lang.Object
   |
   +----jclass.util.JCListenerList

public class JCListenerList
extends Object
implements Serializable
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.


Method Index

 o add(JCListenerList, Object)
 o elements(JCListenerList)
 o remove(JCListenerList, Object)

Methods

 o add
 public static JCListenerList add(JCListenerList list,
                                  Object newListener)
 o remove
 public static JCListenerList remove(JCListenerList list,
                                     Object oldListener)
 o elements
 public static Enumeration elements(JCListenerList list)

All Packages  Class Hierarchy  This Package  Previous  Next  Index