Introduction to OOP Chapter 22: The AWT and Swing : next previous audio real text

Event Listeners

Event listeners are another good example of the use of inheritance and overriding in the Java AWT framework.

Every component (window, button, scroll bar) maintains a list of ``listeners''; objects that are interested in being notified when an event has taken place.

Each type of event is defined by an interface, such as the following:

public interface MouseListener extends EventListener {
	public void mouseClicked (MouseEvent e);
	public void mouseEntered (MouseEvent e);
	public void mouseExited (MouseEvent e);
	public void mousePressed (MouseEvent e);
	public void mouseReleased (MouseEvent e);
}
Intro OOP, Chapter 22, Slide 06