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.io.*;
18
19import sl.*;
20
21public class NameButton01 extends Frame {
22
23 public static void main(String[] args)
24 throws IOException
25 {
26 Frame f = new NameButton01();
27
28 f.setSize(400, 320);
29 f.show();
30 }
31
32 public NameButton01()
33 throws IOException
34 {
35 int[] iList = {2,
36 2,
37 2,
38 1};
39 int NP = iList.length;
40
41 int NB=0;
42 for(int i=0; i<NP; i++)
43 NB += iList[i];
44
45 setLayout(new GridLayout(NP,1));
46
47 Panel[] pList = new Panel[NP];
48 for(int i=0; i<NP; i++)
49 pList[i] = new Panel(new GridLayout(1,iList[i]));
50
51 StringList lList = new StringList(NB);
52 lList.getStringList();
53
54 Button[] bList = new Button[NB];
55 for(int i=0; i<NB; i++)
56 bList[i] = new Button(lList.getStringAt(i));
57
58 int bI=0,
59 eI=0;
60 for(int i=0; i<NP; i++) {
61 eI += iList[i];
62 makePanel(pList,
63 i,
64 bList,
65 bI,
66 eI);
67 add(pList[i]);
68 bI += iList[i];
69 }
70 }
71
72 public void makePanel(Panel[] pList,
73 int pIndex,
74 Button[] bList,
75 int bBIndex,
76 int bEIndex) {
77
78 for(int i=bBIndex; i<bEIndex; i++)
79 pList[pIndex].add(bList[i]);
80 }
81
82}