![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
You connect menus to menu bars, and menu items to menus, using add
.
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; add(menu); menu.add(fileMenuGeneral); menu.add(fileMenuHorror); // Remainder of constructor } // Remainder of class }