I am wondering if it is possible to refresh a Table's GUI when the Object[][]
used to initially populate it has changed.
Object[][] calculationsTableData;
public Interface() {
...
analysisPanel.add(calculationsTable());
...
}
JScrollPane calculationsTable() {
populateCalculationsTableData();
...
calculationsTable = new JTable(calculationsTableData, calculationsColumnNames);
...
}
void populateCalculationsTableData(){
Object[][] temp = new Object[x.numsSize][7];
for (int i = 0; i < x.numsSize; i++) {
temp[i][0] = df.format(x.nums[i]);
...
}
calculationsTableData = temp;
}
populateCalculationsTableData()
is called when the x object has changed to repopulate calculationsTableData
repaint()
and revalidate()
methods do not appear to be effective in this scenario and neither does fireTableDataChanged()
as this is not a table model.