hey guys i was wondering if anyone could help. im trying to add the name, address, home number, mobile number to a JList but i can only seem to save each item to a new line.

any help would be great! thanks

else if (e.getActionCommand() == "Save")
   		{
   			this.details.addElement(this.textName.getText());
   			
   			this.details.addElement(this.textAddress.getText());
   			
   		}

Use a JTable. What you are describing is not a list.

You could override toString() on the object you add to JList to present the description you want, but if you want to present those as separate fields, use a table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.