OK, I want to get all the data from the first column of a JTable. I though the best way would be pulling it in to a ArrayList, so I made one. I also made an instance of a TableModel:
static DefaultTableModel model = new javax.swing.table.DefaultTableModel();
f.data.setModel(model); //f.data is the JTable
public static final void CalculateTotal(){
ArrayList<String> numdata = new ArrayList<String>();
for(int count = 1; count <= model.getRowCount(); count++){
numdata.add(model.getValueAt(count, 1).toString());
}
System.out.println(numdata);
}
This gives me a NullPointerException (cue screams). What am i doing wrong?