Hi Frank ,
what i want ro achieve is to build an array of labels and textfields.
The array would have 6 columns and a variable number of rows depending on
the number of components(labels and textfields) provided.
I want my array to be displayed as follows:
label1-textfield1-label2-textfield2-label3-textfield3
label4-textfield4-label5-textfield5-label6-textfield6
label7-textfield7-label8-textfield8-label9-textfield6
and so on...8
I tried something like the following but it doesn't work when there are (i.e
8 elements , 4 labels and 4 textfields)
===============================================================================
int rows=1;
int cols=6;
int elements=2*currentNodes;
if (elements<=6){
rows =1;
cols=elements;
}
else if (elements>=7)
{
while (elements>=7)
{
elements = elements-6;
rows++;
}
}
Panel nodeSuppliesPanel = new Panel(new GridLayout(rows,6,2,2));
//GridLayout nodeSupplies Panel holds only labels and textfields
for (int i=0;i<currentNodes;i++) // add labels and textfields for
node supplies
{
nodeSuppliesLabels[i]=new Label("b("+(i+1)+")",Label.CENTER);
nodeSuppliesPanel.add(nodeSuppliesLabels[i]);
nodeSuppliesTextFields[i]=new TextField();
nodeSuppliesTextFields[i].setText(String.valueOf(nodeSupplies[i]));
nodeSuppliesPanel.add(nodeSuppliesTextFields[i]);
}// end for
===============================================================================
> Thanasis (sch) wrote:
>> Hello to everyone,
[quoted text clipped - 7 lines]
>
> Perhaps a JTable would be appropriate?
Andrew Thompson - 02 Nov 2004 05:12 GMT
On Mon, 1 Nov 2004 20:56:27 +0200, Thanasis (sch) wrote:
> what i want ro achieve is to build an array of labels and textfields.
I notice you also posted this question on c.l.j.help.
Please refrain from multi-posting Thanasis.
<http://www.physci.org/codes/javafaq.jsp#xpost>
I answered it there. Please restrict your posts to
c.l.j.help for the moment.

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane