1/**
2 * Copyright(C) 1999
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 : July 1, 1999.
11 * @author : Salih Yurttas.
12 */
13
14
15import java.awt.*;
16
17public class PhoneBookAppletInterface extends Panel {
18
19 private static final int pNumber = 2;
20
21 private Panel[] pA;
22 private Button[] bA;
23 private TextField[] tFA;
24 private String[] bLabelA = {"Output",
25 "Input"};
26
27 private String[] name,
28 phone;
29 private int count;
30
31 private PhoneBookAppletActionListener pBAAL;
32
33 public PhoneBookAppletInterface(String[] name,
34 String[] phone,
35 int count) {
36 this.name = name;
37 this.phone = phone;
38 this.count = count;
39
40 BorderLayout bL = new BorderLayout();
41 setLayout(bL);
42
43 pA = new Panel[pNumber];
44 tFA = new TextField[pNumber];
45 bA = new Button[pNumber];
46
47 for(int i=0; i<pNumber; i++) {
48 pA[i] = new Panel(new FlowLayout());
49 tFA[i] = new TextField("", 24);
50 pA[i].add(tFA[i]);
51 bA[i] = new Button(bLabelA[i]);
52 pA[i].add(bA[i]);
53 }
54
55 pBAAL = new PhoneBookAppletActionListener(name,
56 phone,
57 count,
58 tFA);
59 bA[1].addActionListener(pBAAL);
60 tFA[1].addActionListener(pBAAL);
61 add(pA[0], bL.NORTH);
62 add(pA[1], bL.CENTER);
63 tFA[0].setEditable(false);
64 }
65
66}