By using the following code:
|
Code:
|
Vector rows = new Vector();
Vector cols = new Vector();
DefaultTableModel dtf = new DefaultTableModel();
dtf.setDataVector(rows, cols);
JTable table = new JTable(dtf); |
I am able to update the information in the JTable by adding information into the rows vector. However, whenever I sort the JTable using:
|
Code:
|
TableRowSorter sorter = new TableRowSorter(table.getModel());
table.setRowSorter(sorter); |
It works. But the next time I add information into the rows vector, the information isn't displayed on the JTable. I'm not sure why this is, can someone give me some insight? Thanks!
EDIT: As in, BEFORE I sort the table (under any column), I can add as much data as I want onto the JTable. But after sorting ANY column, the data in the JTable will sort, but I can no longer add any more data onto it.