public final synchronized void addListener ( EventListener l ) { if ( l == null ) { throw new IllegalArgumentException ( "Listener " + l + " is null" ) ; } if ( listeners == EMPTY_LISTENERS ) { listeners = new EventListener [ 1 ] ; listeners [ 0 ] = l ; } else { int i = listeners . length ; EventListener [ ] tmp = new EventListener [ i + 1 ] ; System . arraycopy ( listeners , 0 , tmp , 0 , i ) ; tmp [ i ] = l ; listeners = tmp ; } }
Add the listener as a listener to the list .