java.util.EventListener
interface. The AWT defines eleven sub-interfaces of java.util.EventListener
, one for each type of event:
Each of these interfaces defines the events an event listener
of that type must
be prepared to respond to. For example,
MouseListener
declares these methods,
public abstract void mouseClicked(MouseEvent e)
public abstract void mousePressed(MouseEvent e)
public abstract void mouseReleased(MouseEvent e)
public abstract void mouseEntered(MouseEvent e)
public abstract void mouseExited(MouseEvent e)
When a component receives a mouse event, its
processMouseEvent()
method checks the ID of the mouse event
to determine whether this is a mouse pressed, mouse released, mouse entered, or mouse exited event. Then it calls the corresponding method in each registered
MouseListener
object.