How to create a textbox from a for cycle?

0

I have two forms in one I put the number of equations and the other should build as many jtextbox as the number I put in the other frame 'public

void Mostrar(){
        for (int i = 0; i < NumeroDeEcuaciones; i++) {
            JTextField input = new JTextField("texto por defecto",20); 
            this.add(input);
       } 
    }

but do not believe me the textbox

    
asked by Efrainrodc 05.01.2017 в 00:02
source

1 answer

1

I hope it serves you

 JTextField [] campos = new JTextField[numeroDeCampos];
 columna=20;
 fila=10;
 for(int i=0;i<numeroDeCampos;i++)
 {
   campos[i]= new JTextField();
   campos[i].bounds(columna,fila,80,20);
   this.add(campos[i]);
   fila+=30
}

they are partially adding 30px down.

    
answered by 05.01.2017 / 01:22
source