FileDocCategorySizeDatePackage
MenuLayoutDemo.javaAPI DocExample2272Tue Dec 12 18:59:18 GMT 2000None

MenuLayoutDemo

public class MenuLayoutDemo extends JFrame
author
ges

Fields Summary
protected JMenuBar
menuBar
Constructors Summary
public MenuLayoutDemo()

        super("MenuLayoutDemo");
        menuBar = new JMenuBar();
        menuBar.setLayout(new BoxLayout(menuBar, BoxLayout.Y_AXIS));
        addNewMenu("Menu 1");
        addNewMenu("Menu 2");
        addNewMenu("Menu 3");
        getContentPane().add(menuBar, BorderLayout.WEST);

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    
Methods Summary
public voidaddNewMenu(java.lang.String title)

        JMenu m = (JMenu)menuBar.add(new HorizontalMenu(title));
        m.add("Menu item");
        m.add("Menu item");
        m.add("Menu item");
        JMenu m1 = (JMenu)m.add(new HorizontalMenu("Submenu"));
        m1.add("Submenu item");
        m1.add("Submenu item");
    
public static voidmain(java.lang.String[] args)

        MenuLayoutDemo f = new MenuLayoutDemo();
        f.pack();
        f.setVisible(true);