Hi All,
I found the answers of my questions from the SUN's Artical about event handling, I am just posting it here so that all who care can be benifited.
Ajith, My doubt was valid, the New version of Java does not Just support "producer-subscriber" model but support both, here is how:
Compatibility with the old Model
Our intention is to maintain binary compatibility for programs written to the old model for the 1.1 release. However, we strongly recommend new java programs
migrate to the new model. We do not encourage the explicit mixing of the two models within a single
Applet. However, we realize that programs which
code to the new model may need/wish to use existing GUI classes which still use the old model and so we have done our best to ensure this works (for
example, the hotjava browser is a java application which will need to be able to load both 1.0 and 1.1 style applets).
The way this works is that the AWT will recognize a component as being either a 1.0-event-model "target" OR a 1.1-event-model "source", but not both. A
component is recognized to be a 1.1-event-model "source" by meeting one of the following conditions:
1.A listener (of any kind) is registered
2.An event type (of any kind) was explicitly enabled by calling enableEvents()
ELSE the component will be treated as a 1.0-event-model "target" and all events will be delivered to the 1.0 handleEvent method as before.
Note that this is an "all or nothing" distinction and that once the AWT determines a component is a particular event model type, ALL events on that component
will be processed in that context. For example, if a TextField object has only a FocusListener registered, then only focus events will be dispatched to the
textfield in the 1.1 mechanism and the old 1.0 handleEvent method will NEVER be called (not even for other event types!). So while it is possible to combine
components which use the different models, it is not possible to get a single component to mix both models.
One key difference between the two models is that the old model would automatically propagate events up the containment hierarchy, while the new model
does NOT propagate events in this way. The way this works for compatibility is that if an event originates on a component which is a 1.0-event-model "target",
then it WILL be propagated up the hierarchy in the 1.0 fashion, regardless of the event model type of its ancestor containers. If an event originates on a
1.1-event-model "source", then that event will NOT propagate up the hierarchy, regardless of the event model type of its ancestor containers.