I am making a travel planner desktop app. And I have come so far so its only the listing left. I wanna use an Jlist with a defaultListModel or something. But how Do I list all like this???
The result I wanna get is like this:
line : Spårvagn 6
direction : Kortedala via Sahlgrenska
Starting Location : Brunnsparken, Göteborg
time : 17:27
date : 2013-04-03
track : E
Destination : Svingeln, Göteborg
time : 17:56
date : 2013-04-03
track : B
line : Spårvagn 1
direction : Östra Sjukhuset
Starting Location : Brunnsparken, Göteborg
time : 17:30
date : 2013-04-03
track : D
Destination : Svingeln, Göteborg
time : 17:36
date : 2013-04-03
track : B
line : Spårvagn 3
direction : Kålltorp
Starting Location : Brunnsparken, Göteborg
time : 17:35
date : 2013-04-03
track : D
Destination : Svingeln, Göteborg
time : 17:41
date : 2013-04-03
track : B
line : Spårvagn 6
direction : Kortedala via Sahlgrenska
Starting Location : Brunnsparken, Göteborg
time : 17:36
date : 2013-04-03
track : E
Destination : Svingeln, Göteborg
time : 18:05
date : 2013-04-03
track : B
line : Spårvagn 1
direction : Östra Sjukhuset
Starting Location : Brunnsparken, Göteborg
time : 17:40
date : 2013-04-03
track : D
Destination : Svingeln, Göteborg
time : 17:46
date : 2013-04-03
track : B
My code :
JSONObject destination = (JSONObject) jsonObj.get("Destination");
String dname = (String) destination.get("name");
String dtime = (String) destination.get("time");
String ddate = (String) destination.get("date");
String dtrack =(String) destination.get("track");
//set the info about the destination
TripService.getTrip().setDate(date);
TripService.getTrip().setName(dname);
TripService.getTrip().setTime(dtime);
TripService.getTrip().setTrack(dtrack);
//Sets line and direction for all trips
/*
model.addElement("line : " + line);
model.addElement("direction : " + direction);
//set the info about the starting location
model.addElement("Starting Location : " + name);
model.addElement("Time : " + time);
model.addElement("Date : " + date);
model.addElement("Track : " + track);
*/
But it return an [] in my console. How to accomplish this
All this is listed only in my console with this output. But I am not able to transfer it into my application. Whats wrong and how to do this?