-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6
-
Fix Understood
-
generic
-
generic
1. When a same instance of an AWTEventListener is added multiple times, the toolkit class internally maintains only a single instance of the listener and 'OR's the new event mask with the existing one. So this will typically result in listener methods being notified only once regardless of how many times we add the same instance.
But in case of other listeners such as ActionListener, TextListener etc when we add the same instance of the listener multiple times to the same component, all the occurances of the listener would be maintained and will be notified when the event is triggered.
2. Likewise, When we remove an instance of ActionListener/TextListener etc that was added twice, only the last occurance would be removed and other occurances of the same instance would still be maintained. But this is not the case with
AWTEventListener where only one occurance is maintained internally and
that gets removed.
Since AWTEventListener behavior is much different from other listeners available in AWT, it would be better to document this behavior in the toolkit class for better clarity.
But in case of other listeners such as ActionListener, TextListener etc when we add the same instance of the listener multiple times to the same component, all the occurances of the listener would be maintained and will be notified when the event is triggered.
2. Likewise, When we remove an instance of ActionListener/TextListener etc that was added twice, only the last occurance would be removed and other occurances of the same instance would still be maintained. But this is not the case with
AWTEventListener where only one occurance is maintained internally and
that gets removed.
Since AWTEventListener behavior is much different from other listeners available in AWT, it would be better to document this behavior in the toolkit class for better clarity.