I want to add an object to a JList in java. The object has 4 variables which need to be in a single row of JList (represent the values within one object) --> meaning that each object will have its information listed in a single row. I've tried with the default list model but an item gets inserted in JList in this format: classOfObject@1cf3d4e
public static void addElementToList(JList list, Object obj){
DefaultListModel dlm = new DefaultListModel();
int size = list.getModel().getSize();
for (int i=0;i<size;i++){
dlm.addElement(list.getModel().getElementAt(i));
}
dlm.addElement(obj);
list.setModel(dlm);
}