List data = new ArrayList();
// What does get return?
System.out.println("data.get(0) = " + data.get(0).getClass().getName());
Java has no idea what is in this list. The programmer should know but the jvm cannot know. So you must cast the object that the
get method returns. If there are Strings in the list then
String s = (String)list.get(0);
This is acceptable as the argument for the JTextComponent.
setText method.