I have a JTable, associated with a DefaultTableModel, in a JPanel with a SpringLayout which is in a JScrollPane.
When I modify the structure of the DefaultTableModel with the method below the JTable is refreshed but not the JScrollPane. I have to apply a second time this method to refresh the JScrollPane.
public void updateProjectView() {
SwingProjectViewerController spvc = SwingProjectViewerController.
getInstance();
this.projectTitle.setText(spvc.getAcronym() + " : " + spvc.getTitle());
Object[][] tableContent =
spvc.getCriteria(CriteriaPreselectionController.getInstance().
getCriteriaPreselection());
Object[] columnsName = new Object[]{"Col1", "Col2"};
this.tableModel.setDataVector(tableContent, columnsName);
this.tableModel.fireTableStructureChanged();
}
Any help much appreciated!
Here is a test program that shows that when a JTable is held by a JScrollPane and the DefaultTableModel’s DataVector is changed via
setDataVector(...)it is not necessary to callfireTableDataChanged()on the model for the JTable’s data to change correctly and be viewed correctly.The program GUI looks like the images below.
Before Data Changed:
After Data Changed:

The deficiency of my example above is that it does not reproduce the original poster’s problem, and I think that is due to us use of SpringLayout, which he does not fully describe or show code:
For more and better help, the OP is going to have to create his own sscce similar (or simpler) than what I’ve posted above. Either that, or solve his problem by not using SpringLayout to hold the JTable but rather either add it directly to the JScrollPane’s viewport view or add it to a BorderLayout using JPanel (taking care to also add the JTable’s header) and add that to the JScrollPane’s viewport view.