Yurttas/PL/OOL/Java/F/05/02/02/07/Menu00.java

 1/**
 2 *  Copyright(C) 1998
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : January 1, 1998.
11 *  @authorĀ : Salih Yurttas.
12 */
13
14
15import java.awt.*;
16
17import java.awt.event.*;
18
19public class Menu00 extends Frame
20		    implements ActionListener {
21
22  private Menu m = new Menu("Search");
23
24  public Menu00() {
25    super("Menu00");
26    MenuBar mb = new MenuBar();
27
28    // Add item to menu.
29    m.add("Linear");
30
31    // Add listener for menu
32    m.addActionListener(this);
33
34    // Add menu to menu bar
35    mb.add(m);
36
37    // Set menu bar on frame.
38    setMenuBar(mb);
39
40    setSize(320,160);
41    show();
42  }
43
44  // Action handler for menu
45  public void actionPerformed(ActionEvent evt) {
46    System.out.println(evt.getActionCommand());
47  }
48
49  static public void main(String[] args) {
50    new Menu00();
51  }
52
53}