aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Listeners" Watch "Listeners" New topic
Author

Listeners

sean cee
Ranch Hand

Joined: Oct 24, 2000
Posts: 115
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..


Sean <br />SCJP2, SCJP2p1.4, SCWCD
Ira Jain
Ranch Hand

Joined: Sep 06, 2000
Posts: 70
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

Joined: Oct 13, 2000
Posts: 23
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

Joined: Oct 13, 2000
Posts: 9
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

Joined: Oct 24, 2000
Posts: 115
Thanks guys..
That clarify the doubt...
 
jQuery in Action, 2nd edition
 
subject: Listeners