Two Event Handling:
Before beginning our discussion of event handling an important point must be made:the way of events are changed significantly between the original version of java 1.0 and modern version of java.The 1.0 method is still supported but not recommended for new programs.Also,many of the methods that support the old version 1.0 event model have been deprecated.The modern approach is the way that events should be handled by all new programs and thus is the method employed by program of sample.
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 quiet simple a source generates an event and sends it to one or more listeners. In the scheme, the listener simply waits until it receives an event.once an event is received,the listener processes the event and returns. The advantage is this design is that the application logic that process the events is cleanly separated from user interface logic that generates those events.
Events:
In the delegation model,an event is an object that describes a state change in source. It can be generated as a consequence of a person interacting with the elements in the graphical user interface. Some of the activities that cause events to be generated are pressing a button,entering a character via keyboard, selecting an item in a list, and clicking the mouse. Many other user operations could be cited.
Event Source:
A source is an object that generates an event. This occurs when the internal state of that object changes in some way. sources may be generate more than one type of events.
public void addTypeListener(TypeListener el)
Before beginning our discussion of event handling an important point must be made:the way of events are changed significantly between the original version of java 1.0 and modern version of java.The 1.0 method is still supported but not recommended for new programs.Also,many of the methods that support the old version 1.0 event model have been deprecated.The modern approach is the way that events should be handled by all new programs and thus is the method employed by program of sample.
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 quiet simple a source generates an event and sends it to one or more listeners. In the scheme, the listener simply waits until it receives an event.once an event is received,the listener processes the event and returns. The advantage is this design is that the application logic that process the events is cleanly separated from user interface logic that generates those events.
Events:
In the delegation model,an event is an object that describes a state change in source. It can be generated as a consequence of a person interacting with the elements in the graphical user interface. Some of the activities that cause events to be generated are pressing a button,entering a character via keyboard, selecting an item in a list, and clicking the mouse. Many other user operations could be cited.
Event Source:
A source is an object that generates an event. This occurs when the internal state of that object changes in some way. sources may be generate more than one type of events.
public void addTypeListener(TypeListener el)
No comments:
Post a Comment