Java AWT

Previous Chapter 10
Would You Like to Choose from the Menu?
Next
 

10.2 MenuContainer

MenuContainer is an interface implemented by the three menu containers: Frame, Menu, and MenuBar; Java 1.1 adds a fourth, Component. You should never need to worry about the interface since it does all its work behind the scenes for you. You will notice that the interface does not define an add() method. Each type of MenuContainer defines its own add() method to add menus to itself.

MenuContainer Methods

public abstract Font getFont ()

The getFont() method should provide an object's font. MenuItem implements this method, so all of its subclasses inherit it. MenuBar implements it, too, while Frame gets the method from Component.

public abstract boolean postEvent (Event e) (Deprecated)

The postEvent() method should post Event e to the object. MenuComponent implements this method, so all of its subclasses inherit it. (Frame gets the method from Component.)

public abstract void remove (MenuComponent component)

The remove() method should remove the MenuComponent component from the object. If component was not contained within the object, nothing should happen.


Previous Home Next
MenuComponent Book Index MenuShortcut

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java
This HTML Help has been published using the chm2web software.