Klasse javax.swing.event.EventListenerList | 1.2 |
java.lang.Object | +--javax.swing.event.EventListenerList
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); } // Informiert die Listener protected void fireFooXXX() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==FooListener.class) { // Lazily create the event: if (fooEvent == null) fooEvent = new FooEvent(this); ((FooListener)listeners[i+1]).fooXXX(fooEvent); } } }
Datenelemente | |
---|---|
protected Object[] | listenerList |
Konstruktoren | |
---|---|
public | EventListenerList() |
Methoden | |
---|---|
public Object[] | getListenerList() |
public EventListener[] | getListeners(Class t) ![]() |
public int | getListenerCount() |
public int | getListenerCount(Class t) |
public synchronized void | add(Class t, EventListener l) |
public synchronized void | remove(Class t, EventListener l) |
public String | toString() |