Home Freemagazine Issue8 Design Pattern



Design Pattern
Posted on: February 16, 2005 at 12:00 AM
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

Related Tags for Design Pattern:


More Tutorials from this section

Ask Questions?    Discuss: Design Pattern  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.