0

I just wanted to know that i want to remove a particular column from JTable after i click on a button and if i again click on that button it should add the removed column.

Thanks and Regards, Sayed.

Sayed
  • 1

2 Answers2

0

See my answer to "How to make a columns in JTable Invisible for Swing Java".

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
0

I find the XTableColumnModel really handy for this requirement. Use it as the table's column model, and then ask it to hide/show the columns you want.

The best thing about it is that it stores the column's position when you hide it, so that it appears in its same position later when you ask it to be visible again.

mota
  • 5,275
  • 5
  • 34
  • 44