Reputation: 1189
I'm trying to do something on the lines of:
someJtextArea.setText(String.valueOf(
for(int i = 1; i < 0; i++)
{
objInstance.anArrayList.get(i).getFirstName()
}
));
Upvotes: 1
Views: 130
Reputation: 8322
Build your String first and then set the text.
ArrayList<String> numList = new ArrayList<String>();
numList.add("One");
numList.add("Two");
numList.add("Three");
String text = "";
for (String num : numList) {
text += String.format("%s%n", num);
}
myTextArea.setText(text);
Upvotes: 2
Reputation: 285460
Just append to the JTextArea:
Your for loop constraints by the way are a little odd.
For example:
for (Person person: objInstance.anArrayList) {
someJTextArea.append(person.getFirstName() + "\n");
}
(Sorry about my previous wrong answer as I initially thought that you were adding to a JTextField)
Upvotes: 3