Home Segments Top Top Previous Next

775: Mainline

Once you define an observer, you then connect it to a model using the addObserver method, which the model inherits from the Observable class. You could have your program do the connection in the MovieApplication constructor. You should, however, have your program do the connection in the setMovie setter to ensure that the observer is connected to the current value of the movie variable. You need ensured connection in Chapter 46, where you use a choice list to change the value assigned to the movie variable.