Home Segments Top Top Previous Next

871: Mainline

Now, you need to arrange for the movie observer to fetch information from the movie model that is then relayed to a new poster view. Accordingly, you need to modify the definition of MovieObserver previously supplied in Segment 789.

import java.util.*;
public class MovieObserver implements Observer {
 private MovieApplication applet;
 public MovieObserver (MovieApplication a) {
  applet = a;
 }
 public void update (Observable observable, Object object) {
  applet.getMeter().setValue(applet.getMovie().rating());
  applet.getMeter().setTitle(applet.getMovie().getTitle());
  applet.getPoster().setImageFile(applet.getMovie().getPoster()); 
 }                                                       
}