public final class WeakEventListener extends Object implements AWTEventListener
AWTEventListener
and:
Modifier and Type | Method and Description |
---|---|
static WeakEventListener |
attachAsWeakEventListener(Toolkit toolkit,
AWTEventListener listener,
long eventMask)
Creates a new
and adds it to the given using
the given event mask. |
void |
dispose()
Removes itself from the
this listener is attached to. |
void |
eventDispatched(AWTEvent e)
Dispatches the given event to the wrapped event listener.
|
AWTEventListener |
underlyingListener()
Returns the underlying listener.
|
public static WeakEventListener attachAsWeakEventListener(Toolkit toolkit, AWTEventListener listener, long eventMask)
WeakEventListener
and adds it to the given Toolkit
using
the given event mask. The created WeakEventListener
simply "decorates" the given
AWTEventListener
. All events dispatched to the WeakEventListener
are
re-routed to the underlying AWTEventListener
. When the underlying
AWTEventListener
is garbage-collected, the WeakEventListener
will remove
itself from the toolkit.toolkit
- the given AWT Toolkit
.listener
- the underlying listener to wrap.eventMask
- the event mask to use to attach the WeakEventListener
to the toolkit.WeakEventListener
.public AWTEventListener underlyingListener()
public void eventDispatched(AWTEvent e)
null
(garbage-collected,) this listener will remove itself from the default toolkit.eventDispatched
in interface AWTEventListener
e
- the event dispatched in the AWT.public void dispose()
Toolkit
this listener is attached to.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.