import java.awt.*; import java.awt.event.*; public class Menu2b extends MainFrame implements ActionListener { public Menu2b(String title) { super(title); MenuBar mb = new MenuBar(); Menu fm = new Menu("File"); fm.add("New"); fm.add("Exit"); fm.addActionListener(this); mb.add(fm); setMenuBar(mb); } public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); if (cmd.equals("Exit")) { quitApp(); } else if (cmd.equals("New")) { System.out.println("New pressed"); } } public static void main(String[] args) { Menu2b app = new Menu2b("Java 1.1 Implicit Events"); app.show(); } }