Event Listeners
The convention for all event-listener interfaces is for names to end in the word Listener. Like the convention for event objects, this helps to identify the purpose of the interface. All of the event-listener interfaces provided by the core Java class libraries follow this convention.
The methods that are defined in the event-listener interfaces should conform to the standard design pattern for event-notification methods. This allows the programmer to understand the purpose of the methods without having to dig through piles of documentation. The method signature for an event-listener method is as follows:
void <eventOccurenceMethodName>(<EventObjectType> evt);
The event occurrence method name should describe the event. The event
object is passed when the event is fired. This object should be
derived from the class java.util.EventObject. You
can also include a throws clause that lists any
checked exceptions that might be thrown when this method is invoked.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access