Help with GridLayout

Hi everyone, i need help with one GridLayout

this is my code

/***************************************/

GridLayout grid = new GridLayout(10, 5);

    for (int i = 1; i < 10; i++) {
        TextField txt1 = new TextField();
        txt1.setId(i+"1");
        grid.addComponent(txt1, i, 1);
        grid.addComponent(new TextField(), i, 2);
        grid.addComponent(new TextField(), i, 3);
        grid.addComponent(new TextField(), i, 4);
    }

    grid.addComponent(new Label("[0,0]

“), 0, 0);
grid.addComponent(new Label(”[1,0]
“), 1, 0);
grid.addComponent(new Label(”[2,0]
“), 2, 0);
grid.addComponent(new Label(”[3,0]
“), 3, 0);
grid.addComponent(new Label(”[4,0]
“), 4, 0);
grid.addComponent(new Label(”[5,0]
“), 5, 0);
grid.addComponent(new Label(”[6,0]
“), 6, 0);
grid.addComponent(new Label(”[7,0]
“), 7, 0);
grid.addComponent(new Label(”[8,0]
“), 8, 0);
grid.addComponent(new Label(”[9,0]
“), 9, 0);
grid.addComponent(new Label(”[0,1]
“), 0, 1);
grid.addComponent(new Label(”[0,2]
“), 0, 2);
grid.addComponent(new Label(”[0,3]
“), 0, 3);
grid.addComponent(new Label(”[0,4]
"), 0, 4);

/********************************************/

well, i need save the data from textfield in one two-dimensional array

i try this:

for(int i = 0;i<4;i++){
for(int z = 0;z<9;z++){
String[i]
[z]
= ???
}
}

but i havent idea, somebody can help me with this plz?

Hello there,

Is this what you are trying to look at?

Component component = grid.getComponent(z,i)
TextField field = null;
if(component instanceof TextField){
    field = (TextField)component;
    string[z]
=field.getValue();
}else{
    string[z]
=null;
}

ty bro, i discovered other form yesterday

for(int i = 0;i<9;i++){
for(int z = 0;z<4;z++){
TextField txtTemp = (TextField) grid.getComponent(1+i, 1+z);
pepe[i]
[z]
= txtTemp.getValue();
}
}

ty same :slight_smile: