Home Freemagazine Issue8 Design Pattern
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Design Pattern

Advertisement
This design pattern defines one to many dependency between the objects so that if an object changes its state then all the dependent objects are notified and updated automatically.

Design Pattern

       

 

  1. Observer Design Pattern
    This design pattern defines one to many dependency between the objects so that if an object changes its state then all the dependent objects are notified and updated automatically. It is mainly used, to maintain consistency between objects, support to broadcast communication, to maintain classes for further use by making them loosely coupled, to make GUI application and many more. Java API provides a built-in Observable class and Observer interface.

    Here we are taking an example just to demonstrate that how observer pattern works, for this, the example creates two windows. The first window takes the input from the user and the second window displays this input. As soon as the data is entered in the textfield and enter button is pressed, the second window gets the message and displays it with a dialog. The example uses the private inner class.

 

Read more information at:

http://www.javajazzup.com/issue8/page59.shtml

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 16, 2005

Related Tutorials

Ask Questions?    Discuss: Design Pattern  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com