
          Watching Events

There are two orthogonal concepts to deal with when learning
event driven GUI programming. One "dimension" to learn along is
in the direction of all the different events that are possible
in the GUI system (e.g., mouse, key, timer, text, adjustment,
action, focus, etc.). The other "dimension" to learn along is
in the direction of all the different coding styles that event
handlers can be written in.

This folder demonstrates one of these dimensions and keeps the
other dimension fixed. In this folder we see all the possible
kinds of events that the Java GUI system can generate. Every
event is handled in the same style, where we write a separate
class for the event handler object. Each program in this folder
handles just one kind of event. The only thing that any event
handler method does in these examples is print its event object
to the console window.


In the Model-View-Controller pattern, events and event handlers
are part of the Controller. The Controller receives event objects
from the JVM (which gets them from the operating system). The JVM
delivers an event object to a registered event handler method.
In the Java GUI system, an event object can have any one of the
following types. Listed under each event type are the kinds of
components that generate that type of event object.

    1) ActionEvent
        a) button
        b) combo box
        c) list
        d) radio button
        e) text field
        f) menu item
        g) timer
    2) ItemEvent
        a) check box
        b) combo box
        c) list
        d) choices
        e) check box menu item
        f) radio button menu item
    3) AdjustmentEvent
        a) scroll bar
    4) TextEvent
        a) text field
        b) text area
        c) text pane
    5) FocusEvent
        a) all components
    6) KeyEvent
        a) all components
    7) MouseEvent
        a) all components
    8) MouseWheelEvent
        a) all components
    9) ComponentEvent
        a) all components
   10) WindowEvent
        a) windows (including frames and dialogs)


In the Java GUI system, a registered event handler object can
have any one of the following interface types (there is one
type of event handler interface for most types of event objects).
Each of the methods from each of these interfaces will receive an
event object of the corresponding event object type (for example,
the method in the ActionListener interface will receive an
ActionEvent object).

    1) ActionListener       (1 method)
    2) ItemListener         (1 method)
    3) AdjustmentListener   (1 method)
    4) TextListener         (1 method)
    5) FocusListener        (2 methods)
    6) KeyListener          (3 methods)
    7) MouseListener        (5 methods)
       MouseMotionListener  (2 methods)
    8) MouseWheelListener   (1 method)
    9) ComponentListener    (4 methods)
   10) WindowListener       (7 methods)
       WindowFocusListener  (2 methods)
       WindowStateListener  (1 method)


https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/AWTEvent.html
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/event/package-summary.html
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/event/package-summary.html
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/EventListener.html

https://docs.oracle.com/javase/tutorial/uiswing/events/api.html
https://docs.oracle.com/javase/tutorial/uiswing/events/handling.html

https://docs.oracle.com/javase/tutorial/uiswing/components/componentlist.html
