Yurttas/PL/OOL/Java/F/05/02/01/00/BLButtons00.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
17public class BLButtons00 extends Frame {
18
19  public static void main(String[] args) {
20    Frame f = new BLButtons00();
21
22    f.setSize(400,320);
23    f.setVisible(true);
24  }
25
26  private String[] bLabels = {"One",
27                              "Two",
28                              "Three"};
29  private int n = bLabels.length;
30
31  private String[] lLabels = {"North",
32                              "Center",
33                              "South"};
34
35  private Button[] b;
36
37  public BLButtons00() {
38    setTitle("BLButtons00");
39
40    BorderLayout bL = new BorderLayout();
41    setLayout(bL);
42
43    b = new Button[n];
44
45    for(int i=0; i<n; i++) {
46      b[i] = new Button(bLabels[i]);
47      add(lLabels[i],b[i]);
48    }
49  }
50
51}