Home Segments Top Top Previous Next

691: Mainline

You have learned about the windowClosing window listener method. More generally, whenever a window is moved, hidden, or exposed, or has a title-bar button clicked, built-in machinery responds by calling window-listener methods on window-listener class instances connected to the window. The response mechanism also supplies a window event as an ordinary argument.

Whenever you click a mouse button with the mouse over a component's graphical representation, built-in machinery responds to that event by calling mouse listener methods on mouse listener class instances connected to the component. The response mechanism also supplies a mouse event as an ordinary argument.

Similarly, whenever you press a key, built-in machinery responds to that event by calling keyboard listener methods on keyboard listener class instances connected to whatever component is currently responsible for handling key-pressing events. The response mechanism also supplies a keyboard event as an ordinary argument.