FileDocCategorySizeDatePackage
MenuNew.javaAPI DocExample7195Mon Apr 06 18:10:22 BST 1998None

MenuNew

public class MenuNew extends Frame

Fields Summary
String[]
flavors
TextField
t
MenuBar
mb1
Menu
f
Menu
m
Menu
s
CheckboxMenuItem[]
safety
MenuItem[]
file
MenuBar
mb2
Menu
fooBar
MenuItem[]
other
Button
b
Constructors Summary
public MenuNew()

    
    FL fl = new FL();
    for(int i = 0; i < flavors.length; i++) {
      MenuItem mi = new MenuItem(flavors[i]);
      mi.addActionListener(fl);
      m.add(mi);
      // Add separators at intervals:
      if((i+1) % 3 == 0) 
        m.addSeparator();
    }
    for(int i = 0; i < safety.length; i++)
      s.add(safety[i]);
    f.add(s);
    for(int i = 0; i < file.length; i++)
      f.add(file[i]);
    mb1.add(f);
    mb1.add(m);
    setMenuBar(mb1);
    t.setEditable(false);
    add(t, BorderLayout.CENTER);
    // Set up the system for swapping menus:
    b.addActionListener(new BL());
    add(b, BorderLayout.NORTH);
    for(int i = 0; i < other.length; i++)
      fooBar.add(other[i]);
    mb2.add(fooBar);
  
Methods Summary
public static voidmain(java.lang.String[] args)

    MenuNew f = new MenuNew();
    f.addWindowListener(
      new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      });
    f.setSize(300,200);
    f.setVisible(true);