Java listener must inherit from java.util.EventLis

2020-07-06 06:47发布

In the javadoc it says that EventListener is

"A tagging interface that all event listener interfaces must extend."

Why is that? What's the significance of making a custom listener implement EventListner? Is there any special handling for EventListner somewhere?

2条回答
太酷不给撩
2楼-- · 2020-07-06 07:28

It’s only important if you want to use an EventListenerList or an EventListenerProxy. I like to use it on my own event listener interfaces as well, though. It makes the purpose of the interface much clearer.

查看更多
放荡不羁爱自由
3楼-- · 2020-07-06 07:43

Probably used by javabeans introspection.

For instance Netbeans beaninfo editor does not recognise the event if extends EventListener is missing from the Listener.

查看更多
登录 后发表回答