Yurttas/PL/OOL/Java/F/05/01/03/00/Menu01.java

From ZCubes Wiki
Jump to navigation Jump to search
 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  static public void main(String[] args) {
23    Frame f = new Menu01();
24
25    f.setSize(320,160);
26    f.show();
27  }
28
29  private static MenuBar mB;
30  private static Menu m;
31
32  public Menu01() {
33    super("Menu-01");
34    mB = new MenuBar();
35
36    m = new Menu("Search");
37
38    m.add("LinearSearch");
39    mB.add(m);
40
41    m.add("BinarySearch");
42    mB.add(m);
43
44    m.addActionListener(this);
45
46    setMenuBar(mB);
47  }
48
49  public void actionPerformed(final ActionEvent aE) {
50    System.out.println(aE.getActionCommand());
51  }
52
53}