Daniel Thoma: Array von TextField

Beitrag lesen

Hallo Nicole,

TextField[][] fieldsMatrix;

public void produceMatrix()
{
               int yPos = 50, xPos = 50;

fieldsMatrix = new TextField[states.length()][workAlph.length()];

for(int i=0; i<states.length(); i++)
               {
                       yPos = yPos + 30;
                       for(int j=0; j<workAlph.length(); j++)
                       {
                               xPos =xPos + 30;

fieldsMatrix[i][j] = new TextField()

fieldsMatrix[i][j].setBounds(xPos,yPos,30,20);
                               add(fieldsMatrix[i][j]);
                       }
                       xPos = 50;
               }

}
}

So sollte es gehen. new TextField[states.length()][workAlph.length()]; erzeugt einen _leeren_ Array.

Grüße

Daniel