Java Reference
In-Depth Information
A subclass like JFrame inherits state and behavior from all of its ancestors.
For example, the DVD class can refer to any method or variable belonging to
JFrame, JFrame's superclass of Frame, or Frame's superclass of Container.
Creating a JMenuBar
A JMenuBar is the Swing version of the AWT MenuBar. The constructor method
of the JMenuBar creates an object that can be set at the top of a JFrame through
the use of the setJMenuBar() method . Each command on a JMenuBar is con-
structed as a JMenu. The commands that display on the drop-down list for each
JMenu are constructed as JMenuItems. Figure 7-16 displays the three compo-
nents (JMenuBar, JMenu, and JMenuItem) used in common Swing menus.
JMenu
Component s
JMenu Item
C omponen ts
JMenuBar
FIGURE 7-16
More methods are available with Swing menus than with AWT menus.
Table 7-7 displays some of the common methods and examples.
 
Search WWH ::




Custom Search