What is necessary for a JavaBeans component to be an event source?

John Zukowski

Components must implement add and remove listener methods (addXXXListener() and removeXXXListener())to maintain a list of targets and implement code to notify the targets when the event happens. Care must be taken to avoid race conditions and deadlocks when writing code to notify targets, as the list of targets to notify is the set of listeners when the event happened.

See How do I create my own events to pass between objects? for a complete example.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact