JTable.removeColumn() method throws exception
Posted
by
sanjeev
on Stack Overflow
See other posts from Stack Overflow
or by sanjeev
Published on 2012-09-01T03:23:06Z
Indexed on
2012/09/01
3:38 UTC
Read the original article
Hit count: 125
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.
© Stack Overflow or respective owner