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