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  >>

Advertisement

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



Google
  Web Artima.com   
Copyright © 1996-2017 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us