Reputation: 633
I Created two Jtable table1 and table2. I give table1 header to table2 by this code.
table2.setTableHeader(table1.getTableHeader());
but i also want to give properties of table1 header to table2. like Sorting and Margin re-sizing.
Upvotes: 0
Views: 51
Reputation: 324118
like Sorting
Sorting is controlled by the RowSorter so I would guess you also need to share the sorter.
Read the secton from the Swing tutorial on Sorting and Filtering for more information.
I guess you would use getRowSorter(...)
on table1 and setRowSorter(...)
on table2.
Upvotes: 1
Reputation: 109813
but i also want to give properties of table1 header to table2. like Sorting and Margin re-sizing.
to share TableColumnModel for both JTables,
to use, override methods columnMarginChanged
and columnMoved
, both are implemented in TableColumnModelListener,
Upvotes: 1