Respuesta :

celai
Pressing a button generates an action event. Intended for an event to have some result, a program must notice the event and respond to it. For each event class there is an interface that refers to one or more approaches for responding to events of the class. For example, related with the class action event is an interface called action listener. This interface plans a way, public void act accomplished. An object needs to reply to action events must implement this interface. By applying the action listener interface, an object develops accomplished of listening for action events. But before it can really hear any events, it should be registered as an action listener. Events are made by components. When the user clicks on a button for example an action event is generated. Each constituent that can make action events has a way called add action listener. This way is used to list action listeners with the constituent. When the constituent makes an action event, it informs any shown action listeners by calling their action methods.