Home Segments Top Top Previous Next

849: Mainline

The applet shown in Segment 848 involves not only a choice list but also a new model class, MovieData. As usual, before you define that class, you begin with an interface definition. That definition establishes a setter and getter for a vector of movies. It also establishes a getter for the movie at a particular place in the vector, and a method that activates observers.

import java.util.*; 
public interface MovieDataInterface  { 
 // Put movies into data source: 
 public abstract void setMovieVector (Vector v) ; 
 // Extract movies from data source: 
 public abstract Vector getMovieVector () ; 
 // Find a particular movie at given index: 
 public abstract Movie getMovie(int index) ; 
 // Miscellaneous method: 
 public abstract void changed () ; 
}