rendered paste body
import javax.swing.table.AbstractTableModel;
import java.util.ArrayList;
class PatioProjectTableModel extends AbstractTableModel {
private String[] columnNames = {"shape", "dimension", "material", "cost"};
// each elemnt's property in separate arrays:
private ArrayList<String> shapeList;
private ArrayList<Double> widthList;
private ArrayList<Double> lengthList;
private ArrayList<String> materialList;
private ArrayList<Double> costList;
/**
* constructor
*/
public PatioProjectTableModel() {
super();
shapeList = new ArrayList<String>();
widthList = new ArrayList<Double>();
lengthList = new ArrayList<Double>();
materialList = new ArrayList<String>();
costList = new ArrayList<Double>();
}
/**
* column count
*/
public int getColumnCount() {
return columnNames.length;
}
/**
* row count
*/
public int getRowCount() {
// just assume that all arrays are the same size
return shapeList.size();
}
/**
* column name
*/
public String getColumnName(int col) {
return columnNames[col];
}
... more code which isn't finished
}