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
WeakEventListener and adds it to the given Toolkit using the given event mask. |
void |
dispose()
Removes itself from the
Toolkit this listener is attached to. |
void |
eventDispatched(AWTEvent e)
Dispatches the given event to the wrapped event listener.
|
AWTEventListener |
underlyingListener() |
@Nonnull public static WeakEventListener attachAsWeakEventListener(@Nonnull Toolkit toolkit, @Nonnull 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
.@Nonnull 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 © 2014–2019 AssertJ. All rights reserved.