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