How can I make my JTable show specific stuff for each column?
Can I use an Object for more than one column? I want to have a column showing the date (dd.mm.yyyy) and another to show the time (hh:mm) but as I have it now it only shows the String representation of the Date object as a whole.
public class AppointmentTableModel extends AbstractTableModel {
...
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return appointments.get(rowIndex).getByColumn(columnIndex);
}
}
public class Appointment {
...
public Object getByColumn(int columnIndex) {
switch (columnIndex) {
case 0: return date;
case 1: return date;
case 2: return sample;
case 3: return sample;
case 4: return history;
case 5: return comment;
}
return null;
}
}