IV. EventHandling

The GUI framework JControl/Wombat provides mechanisms for an message based handling of events that are used by all interactive components. Programmers of JControl/Wombat based applications just have to implement an ActionListener to be albe to react to user inputs. How to install an ActionListener onto a specific GUI component and process its ActionEvents, will be shown in the following sections.

Figure 1: Event Handling by JControl/Wombat

Figure 1 outlines the principle of the transmission of messages by JControl/Wombat: An event loop, which runs as a background thread, is automatically installed by the class Frame. This loop continuously queries keyboard and touch screen and triggers a KeyEvent or a TouchEvent respectively whenever the user provides some input. The Event then is transmitted to the user interfaces' Container framework, that now has to determine which GUI component has to be associated with the Event. Depending on the type of event, the deciding factors are either the location of the GUI component on screen (TouchEvent) or the current ownership or the input focus (KeyEvent). The determined GUI componente will now react on the user input and eventually trigger an ActionEvent.

Once the application has attached an ActionListener to a GUI component (via the method setActionListener(ActionListener listener)), it is able to receive the ActionEvents issued by this specific GUI component. On the occurrence on an ActionEvent, JControl/Wombat will call the listeners onActionEvent(ActionEvent event), where application specific actions may be implemented.