Yurttas/PL/OOL/Java/F/05/01/02/04/00/Panels01.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 Panels01 extends Frame {
18
19  public static void main(String[] args) {
20    Frame f = new Panels01();
21
22    f.setSize(400,320);
23    f.setVisible(true);
24  }
25
26  private static String[] pLabels = {"One",
27                                     "Two",
28                                     "Three"};
29  private static final int N = pLabels.length;
30
31  private Panel[] p;
32  private Label l;
33
34  public Panels01() {
35    setTitle("Panels01");
36
37    FlowLayout fL = new FlowLayout();
38    setLayout(fL);
39
40    p = new Panel[N];
41
42    for(int i=0; i<N; i++) {
43      p[i] = new Panel(fL);
44      for(int j=i; j<N; j++) {
45        l = new Label(pLabels[j]);
46        p[i].add(l);
47      }
48      add(p[i]);
49    }
50  }
51
52}