JTable.removeColumn() method throws exception
- by sanjeev
To hide a column from only the view of JTable, i am using the removeColumn() method. But it throws the exception
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 7 >= 7
at java.util.Vector.elementAt(Vector.java:470)
at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:294)
at javax.swing.plaf.basic.BasicTableHeaderUI.paint(BasicTableHeaderUI.java:648)
i think, after removing column from the view, if i modified the model, then this exception pops out. is it because of there is no column in view, while the model is updating the table ?
What is the best way to hide the column in view in JTable ? insteading of setting the sizes to 0.