I decided it would be easiest to store my data in a custom Row object based on this post
Java data structure to store tabular data
But Im wondering how I actually go onto then create a JTable with this Array of row objects
My current attempt starts out looking like this:
public class TestTable extends JTable {
private final String[] columnNames = {"col1", "col2", "col3"};
public TestTable() {
DefaultTableModel model = new DefaultTableModel(columnNames, 10); //10 is just a placeholder for the number of rows as I dont know how to add the data yet
}
}
My data would be stored in an ArrayList that looks like this:
Row row1 = new Row("1", "2", "3");
ArrayList<String> data = new ArrayList<String>;
data.add(row1);
data.add(row2);
...
data.add(row10);
where my final ArrayList would just look like a list of row objects