Reputation: 29
I have used TableRowsorter to filter some rows out from myJtable. Is there a way I can take all the values from a column and store it in arraylist after the filter from the Jtable.
Upvotes: 0
Views: 151
Reputation: 347204
Conceptually, something like this...
// Apply filter...
int col = ...; // Column you're interested in
List values = new ArrayList(table.getRowCount());
for (int row = 0; row < table.getRowCount(); row++) {
values.add(table.getValueAt(row, col));
}
will work.
Because JTable
is a representation of the filtered (and sorted) data, you can just walk through it to get the values it's presenting
Upvotes: 1