is there an easy way to remove all Listeners from a JComponent?
JComponent widget = getComponentOverScaryMethod();
EventListener[] listners = widget.getListeners(EventListener.class);
for (EventListener l : listners) {
widget.remove*RandomListener*(l);
}
Background:
I have a JComponent with an unknown amount of Listeners (random types). Since the widget should be removed from the visible part (and won't be needed again) it should be destroyed (and the Listeners should be deleted).
Thanks in advance Joan
There's a workaround mentioned here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With