Filter Editor

There are two different types of filters: event filters and message filters. An event filter triggers on AWT events, and a message filter triggers on messages from other groups. The target for these events and messages must match the component or group for which the operation is being defined.

Event Filter

There are many different event filters that can be defined for an action. Some examples are Mouse Press, Key Down, and Action Event. An event filter is used to select particular types of AWT events for which an action should be invoked (see the JDK documentation of the AWT Event class for more details).

There are four aspects to an event filter:

The only required element is the Id. The Id determines the type of event for the filter. The Key, Modifiers, and Click Count fields are used to further narrow the scope of the filter for a given event Id.

For example, the set of events selected by the Key Down event Id can be further narrowed by specifying a Key filter of C. This can be narrowed even further by specifying the Modifier Control. This filter will be triggered when the operation's component has the keyboard focus and the user presses Control+C.

Available modifiers depend on the event Id. For Key events, the modifiers are:

For mouse events, the modifiers are:

The Click Count element is important only for mouse events. To catch a double-click, the event Id is "Mouse Down" and the Click Count is 2.

Message Filter

With this version of GUI builder, messages are not automatically generated, you must write the code that generates a message. You can use the operations dialog box to specify incoming messages and the actions that they trigger when they are received.

A message filter has three parts:

Each of these parts is a string that is matched against any messages that are received. The message Name and Target Name must be specified, but the Type can be left blank. The Type is an additional filter within the scope of the message name. Note that the target object is always searched for and must match the Target Name if a Target Name is supplied.

The component for which the operation is defined must be the originator of the message, or the filter will not be triggered. For example, you might have a custom subgroup that sends out Apply messages. To trigger off of the Apply message, you should select the subgroup and then edit its operations attribute. Then define an operation that has a message filter with the name Apply.

See also:

What Is a Component Operation?
Adding Operations to Components
GUI Builder Runtime Classes
What Are Groups and Shadows?
More On Groups and Shadows

Visual Java GUI Builder API Documentation
Visual Java GUI Builder Runtime Packages
Class Hierarchy
Index of All Fields and Methods