Home Segments Top Top Previous Next

950: Mainline

At this point, you readily can install a menu in the evolving movie-rating application. Because none of the other application instances send information to the menu, you can add the menu by subclassing the MovieApplication class provided in Segment 932.

import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class MovieApplicationWithMenuBar extends MovieApplication {
 // Declare variables
 MovieMenuBar movieMenuBar;                                     
 // Define constructor
 public MovieApplicationWithMenuBar () {
  // Do what MovieApplication does
  super();
  // Install menu bar
  setJMenuBar(new MovieMenuBar(this));                          
 } 
}