|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.lirc.EventListenerList
Simliar to javax.swing.EventListener, but easier to use. Usage:
EventListenerList listenerList = new EventListenerList();
FooEvent fooEvent = null;
public void addFooListener(FooListener l) {
listenerList.add(FooListener.class, l);
}
public void removeFooListener(FooListener l) {
listenerList.remove(FooListener.class, l);
}
protected void fireFooXXX() {
FooEvent e = null;
EventListener[] ls = listenerList.getListeners(FooListener.class);
for (int j = ls.length-1; j >= 0; j--) {
FooListener l = (FooListener)ls[j];
if (e == null) e = new FooEvent();
l.fireFooXXX(e);
}
}
| Constructor Summary | |
EventListenerList()
Creates a new empty EventListenerList. |
|
| Method Summary | |
void |
add(java.lang.Class t,
java.util.EventListener l)
Adds the listener as a listener of the specified type. |
int |
getListenerCount()
Returns the total number of listeners for this listener list. |
int |
getListenerCount(java.lang.Class t)
Returns the total number of listeners of the supplied type for this listener list. |
java.util.EventListener[] |
getListeners(java.lang.Class t)
Return an array of all the listeners of the given type. |
void |
remove(java.lang.Class t,
java.util.EventListener l)
Removes the listener as a listener of the specified type. |
java.lang.String |
toString()
Returns a string representation of the EventListenerList. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public EventListenerList()
| Method Detail |
public int getListenerCount()
public int getListenerCount(java.lang.Class t)
public java.util.EventListener[] getListeners(java.lang.Class t)
ClassCastException - if the supplied class
is not assignable to EventListener
public void add(java.lang.Class t,
java.util.EventListener l)
t - the type of the listener to be addedl - the listener to be addedjava.lang.IllegalArgumentException - if l is not an instance of t
public void remove(java.lang.Class t,
java.util.EventListener l)
t - the type of the listener to be removedl - the listener to be removedjava.lang.IllegalArgumentException - if l is not an instance of tpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||