Search code examples
javaarraystextboxtostringsettext

How put each array value into text-field in Java?


I tried to put array values into separate textfields. IDE indicates code is always gone wrong. There are 6 text fields and 6 values in the array. So I need that 6 array values put into textfields. Check my code and help me correct it. (This array is Integer one)

import java.util.Arrays   
.
...

numO1.setText(Arrays.toString(Isortarray[0]));
numO2.setText(Arrays.toString(Isortarray[1]));
numO3.setText(Arrays.toString(Isortarray[2]));
numO4.setText(Arrays.toString(Isortarray[3]));
numO5.setText(Arrays.toString(Isortarray[4]));
numO6.setText(Arrays.toString(Isortarray[5]));

Solution

  • Hope this will help you :)

    numO1.setText(String.valueOf(Isortarray[0]));