Home Segments Top Top Previous Next

774: Mainline

One way to write the observer class is to define it in the MovieApplication class as a local class definition, as shown in the following example.

private class LocalMovieObserver implements Observer {                    
 public void update (Observable observable, Object object) {     
  getMeter().setValue(getMovie().rating());                      
  getMeter().setTitle(getMovie().getTitle());                    
}}