import javax.swing.table.*;
public class Table_Model extends AbstractTableModel{
String[] colHead;
Object[][] data;
public Table_Model(String[] str, Object[][] data){
colHead = str;
this.data = data;
}
public int getColumnCount(){
return colHead.length;
}
public int getRowCount(){
return data.length;
}
public String getColumnName(int col){
return colHead[col];
}
public boolean isCellEditable(int row, int col){
return true; //false 이면 셀수정안됨
}
public Object getValueAt(int row, int col){
return data[row][col];
}
public void setValueAt(Object value, int row, int col) {
data[row][col] = value;
fireTableCellUpdated(row, col);
}
}




덧글