A listener is called when the user does something to the user interface that causes an event. Although these events usually come from the user interface, they can have other sources (eg, a Timer).
Button listener example
After a button is created, you will add a listener to it. Eg,
b.addActionListener(listener_object);
When the button is clicked, a call is made to the actionPerformed() method defined in the class of the listener object. An ActionEvent object is passed as a parameter to it actionPerformed().