Semantics : GuiEventsStatement

GuiEventsStatement  ::=  guiEvents {
( < (
( ? IDENTIFIER | ( PrimaryExpr ),+ )
: IDENTIFIER
: ( IDENTIFIER ),+
),+ > : ( Statement )+
)*
}

Used by:  

This statement allows event handlers be specified for all Java GUI events, either for one or more components, or as a generic handler that can be dynamically attached to any number of components. One GUI program can have more than one GUI event handler statment. This statement eliminates the need to define tons of anonymous classes for handling GUI events.

Each handler starts with a < > : event-binding section followed by a number of statements, where $_ represents the current event object.

In the event-binding section, there are three parts, separated by : 's. The first part, which normally is one or more PrimaryExpr that are evaluated to be Java GUI components, are the event receivers. This part can also be a name preceded by a ? that defines a named, generic event handler, which can be later dynamically attached to any components (see getGuiHandler()). The second part of the event-binding section is an "event name", which corresponds to the name portion of a Java GUI event listener name, e.g. Window in java.awt.event.WindowListener. The third part of the event-binding section can be one or more event listener method names, such as windowOpened and windowIconified. Normally, the event object itself ($_ ) has a field indicating the message type as well the source and/or target of the event.