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 Menu01 extends Frame
20 implements ActionListener {
21
22 private Menu m = new Menu("Search");
23
24 public Menu01() {
25 super("Menu01");
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 // Add item to menu.
38 m.add("Binary");
39
40 // Add menu to menu bar
41 mb.add(m);
42
43 // Set menu bar on frame.
44 setMenuBar(mb);
45
46 setSize(320, 160);
47 show();
48 }
49
50 // Action handler for menu
51 public void actionPerformed(ActionEvent evt) {
52 System.out.println(evt.getActionCommand());
53 }
54
55 static public void main(String[] args) {
56 new Menu01();
57 }
58
59}