1 36 37 40 41 52 53 import javax.swing.table.*; 54 import javax.swing.event.TableModelListener ; 55 import javax.swing.event.TableModelEvent ; 56 57 public class TableMap extends AbstractTableModel implements TableModelListener 58 { 59 protected TableModel model; 60 61 public TableModel getModel() { 62 return model; 63 } 64 65 public void setModel(TableModel model) { 66 this.model = model; 67 model.addTableModelListener(this); 68 } 69 70 73 public Object getValueAt(int aRow, int aColumn) { 74 return model.getValueAt(aRow, aColumn); 75 } 76 77 public void setValueAt(Object aValue, int aRow, int aColumn) { 78 model.setValueAt(aValue, aRow, aColumn); 79 } 80 81 public int getRowCount() { 82 return (model == null) ? 0 : model.getRowCount(); 83 } 84 85 public int getColumnCount() { 86 return (model == null) ? 0 : model.getColumnCount(); 87 } 88 89 public String getColumnName(int aColumn) { 90 return model.getColumnName(aColumn); 91 } 92 93 public Class getColumnClass(int aColumn) { 94 return model.getColumnClass(aColumn); 95 } 96 97 public boolean isCellEditable(int row, int column) { 98 return model.isCellEditable(row, column); 99 } 100 104 public void tableChanged(TableModelEvent e) { 106 fireTableChanged(e); 107 } 108 } 109 | Popular Tags |