Home Segments Top Top Previous Next

945: Mainline

To create a menu bar for the evolving movie application, you create a subclass of the JMenuBar class.

import java.awt.*; 
import java.util.*; 
import java.awt.event.*; 
import javax.swing.*; 
import javax.swing.event.*; 
public class MovieMenuBar extends JMenuBar { 
 MovieApplication applet; 
 private JMenu menu = new JMenu("File");  
 private JMenuItem fileMenuGeneral = new JMenuItem("General");  
 private JMenuItem fileMenuHorror = new JMenuItem("Horror");  
 public MovieMenuBar (MovieApplication a) { 
  applet = a; 
  // Remainder of constructor 
 } 
 // Remainder of class 
}