When printing client data in the JTextField, when \n
is present it means a line break, but instead of moving to the next line each time it finds a \n
, it simply ignores and continues to write forward.
Follow the code below:
lista.setText(clientes[i].toString());
public String toString(){
return String.format("\t-----------------------Cliente Regular-------------------------\n[%s]\t-> Nome: %s\n\t->Contacto: %s\n\t->NIF: %d\n\t->E-email: %s\n\t->Morada: %s\n",super.getnickname(),super.getnome(),super.getcontacto(),super.getnif(),super.getemail(),super.getmorada());
}
And your output should look something like:
"\t-----------------------Cliente Regular-------------------------\n
[%s]\t-> Nome: %s\n
\t->Contacto: %s\n
\t->NIF: %d\n
\t->E-email: %s\n
\t->Morada: %s\n"
Can someone help me?