Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.LinkedList;
- import java.util.List;
- import javax.swing.table.AbstractTableModel;
- public class ProgramTableModel extends AbstractTableModel
- {
- public List<Program> schedule;
- protected String[] columnNames = {"Title", "Duration", "Category", "Actor", "Director", "Rentable", "Synopsis"};
- public ProgramTableModel(List<Program> schedule)
- {
- this.schedule= schedule;
- }
- public int getColumnCount()
- {
- return 7;
- }
- public int getRowCount()
- {
- return schedule.size();
- }
- public String getColumnName(int column) {
- return columnNames[column];
- }
- public Object getValueAt(int rowIndex, int columnIndex)
- {
- Program sData = schedule.get(rowIndex);
- switch (columnIndex)
- {
- case 0: return sData.getTitle();
- case 1: return sData.getDuration();
- case 2: return sData.getCategory();
- case 3: return sData.getActor();
- case 4: return sData.getDirector();
- case 5: return sData.getRentable();
- case 6: return sData.getSynopsis();
- default: return "Not Available.";
- }
- }
- public List<Program> getData() {
- return schedule;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement