JList setListData

Hi everyone

I have a small problem regarding the Jlist.setListData() I’m trying fill the Jlist with custom objects i.e

public class user{

private String name_;

public user(String name){
this.name_ = name


the simple class, I have filled all users into an ArrayList() and then passed that filled ArrayList to


The results i’m get are showing the objects, is there away to show the user name and keep the object in the List? or is there a way to map the object to the user name?

Thanks for reading and any help will be much appreciated.

You need to add a toString() method to your User class (note: I capitalized the class name, so should you)

Thank you so much of the fast reply thats what i was looking for! and yes I have capitalized that name.