aspose file tools*
The moose likes Java in General and the fly likes ObserverPattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "ObserverPattern " Watch "ObserverPattern " New topic
Author

ObserverPattern

Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
Hi,
I need to look some very simple code example for ObserverPattern.
can any one give some example for beginner level code.

regards,
Ramesh
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Have a look at this
By the way, jdk also provides an implementation for this pattern, here are the related classes:

Observable

Observer


apigee, a better way to API!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19544
    
  16

Ah yes, java.util.Observable...

It can be used as an example on how to implement this yourself, but I find the class highly unusable - if you want to use it, your classes must become subclasses of Observable. It should have been an interface instead, with a default implementation like AbstractObservable or DefaultObservable.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ObserverPattern
 
Similar Threads
logging solution
method overriding
garbage collection
How to set value to JFrame from JInternalFrame
In a mess: state pattern + observer pattern + concurrency + ...