0

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.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Aqeel Haider
  • 603
  • 7
  • 24

2 Answers2

1

but i also want to give properties of table1 header to table2. like Sorting and Margin re-sizing.

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319
1

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.

camickr
  • 321,443
  • 19
  • 166
  • 288