Showing posts with label event Handling. Show all posts
Showing posts with label event Handling. Show all posts

Wednesday 5 February 2014

Event classes:The ContainerEvent Class

 ContainerEvent:added to or removed from a container.

The ContainerEvent Class


A ContainerEvent is generated when a component is added to or removed from a container.


 container events:


  •  COMPONENT_ADDED 
  •  COMPONENT_REMOVED

They indicate that a component has been added to or removed from the container.
ContainerEvent is a subclass of ComponentEvent and has this constructor:

Saturday 1 February 2014

Event Classes:The AdjustmentEvent Class

AdjustmentEvent:BLOCK-DECREMENT,TRACK,INTEGER CONSTANT

The AdjustmentEvent Class

An AdjustmentEvent is generated by a scroll bar.

Adjustment events.


  • BLOCK_DECREMENT :

             The user clicked inside the scroll bar to decrease its value.

  • BLOCK_INCREMENT:

            The user clicked inside the scroll bar to increase its value.

  • TRACK:

         The slider was dragged.

  • UNIT_DECREMENT :

        The button at the end of the scroll bar was clicked to decrease its value.

  • UNIT_INCREMENT :

         The button at the end of the scroll bar was clicked to increase its value.

Event classes:The ActionEvent Class

The ActionEvent Class


An ActionEvent is generated when a button is pressed, a list item is double-clicked, or a menu item is selected.

The ActionEvent class defines four integer constants that can be used to identify any modifiers associated with an action event: 


  • ALT_MASK
  • CTRL_MASK
  • META_MASK
  • SHIFT_MASK
  • ACTION_PERFORMED

Event Handling

The event. Event handling is fundamental to Java programming because it is integral to the creation of applets and other types of GUI-based programs. 


The Delegation Event Model

The modern approach to handling events is based on the delegation event model, which defines standard and consistent mechanisms to generate and process events. Its concept is quite simple:a source generates an event and sends it to one or more listeners.In this scheme, the listener simply waits until it receives an event. Once an event is received, the listener processes the event and then returns.
                         In the delegation event model, listeners must register with a source in order to receive an event notification. This provides an important benefit: notifications are sent only to listeners that want to receive them.an event was propagated up the containment hierarchy until it was handled by a component.