Skip to content

Instantly share code, notes, and snippets.

@beydogan
Created June 10, 2013 21:19
Show Gist options
  • Save beydogan/5752419 to your computer and use it in GitHub Desktop.
Save beydogan/5752419 to your computer and use it in GitHub Desktop.
DefaultTableModel tm = new DefaultTableModel();
Vector<String> columns = new Vector<String>();
columns.add("ID");
columns.add("From");
columns.add("To");
columns.add("Departure Time");
columns.add("Fare");
tm.setColumnIdentifiers(columns);
if (routes == null) {
this.searchResultTable.setModel(tm);
return;
}
Vector<Object> row;
ListIterator<Route> lstrg = routes.listIterator();
while (lstrg.hasNext()) {
Route route = lstrg.next();
em.refresh(route);
row = new Vector<Object>();
row.add(route.getId());
row.add(route.getFromCity().getName());
row.add(route.getToCity().getName());
row.add(route.getDepartureTime());
row.add(route.getFare());
tm.addRow(row);
}
this.searchResultTable.setModel(tm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment