The Artima Developer Community
Sponsored Link

Event Generator Idiom
When and How to Make a Java Class Observable
by Bill Venners
First Published in JavaWorld, August 1998

<<  Page 4 of 10  >>


The solution
The solution is to implement an event delegation mechanism between the information provider (the event generator) and the recipients (the listeners).

Here's a step-by-step outline of Java's idiomatic solution to this problem:

Step 1. Define event category classes

Step 2. Define listener interfaces

Step 3. Define adapter classes (optional)

Step 4. Define the observable class

Step 5. Define listener objects

<<  Page 4 of 10  >>

Sponsored Links

Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use