I have a JTable
and a JComboBox
. I want certain columns to hide when I select one item in the combobox and the same hidden columns to reappear when I select the other item in the combobox. I write,
jTable1.getColumnModel().getColumn(8).setMinWidth(0)
jTable1.getColumnModel().getColumn(8).setMaxWidth(0)
jTable1.getColumnModel().getColumn(8).setWidth(0)
for hiding the column, but when I again write
jTable1.getColumnModel().getColumn(8).setMinWidth(100)
jTable1.getColumnModel().getColumn(8).setMaxWidth(100)
jTable1.getColumnModel().getColumn(8).setWidth(100)
the hidden columns do not become visible.