• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Listeners

 
sean cee
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
a) If multiple listeners are added to a component, the order of invokation is specified to be the order in which they were added.
this is false, isn't it?
one mock exam i did, it said true, but other exam said it was false.
Can someone help me out?
Thanks in advance..
 
Ira Jain
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean,
You are right. As per the event delegation model which is used in Java 2 ,all listeners of a particular event are notified but the order in which they are notified may/may not be the same as the order in which they were added.

Hope it helps,
Ira

------------------
 
Mary Anitha
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The RHE book says
there is no guarantee that the listeners will be notified in the order in which they were added.
So I think that the answer should be false
 
Claude Rouleau
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will say that it is exact that you cannot garantee the order in wich listener will be called but
If you subclass a component (like Button) and in the constructor of the class that you are building you call the enableEvents method + you override the processActionEvent method of the component. The processActionEvent method that you provided will be called before any listener of this component.
Hope this help.

[This message has been edited by Claude Rouleau (edited October 25, 2000).]
 
sean cee
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys..
That clarify the doubt...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic