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 Visual Java, 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 must be specified, but the type and target name can be left blank. The type and target name are additional filters within the scope of the message name.

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 inside your group and that subgroup 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:

Visual Java Overview
The Visual Menu
Visual Java Components
Laying Out GUI Interfaces
Generating Java Source Code
Adding Operations (Filters and Actions)
Visual Java Runtime Classes
Creating Menus
Adding Custom Components and Windows
Using Groups and Shadows (Basic)
Using Groups and Shadows (Advanced)
Visual Java API Documentation
Visual Java Runtime Packages
Class Hierarchy
Index of all Fields and Methods