How to hide columns in JTable so that they can still be accessed using tableModel.getValueAt(row,colHidden)?
I did that way, but then I was unable to access 6th column using tableModel.getValueAt(row,6):
tbl.getColumnModel().getColumn(6).setPreferredWidth(0);
tbl.getColumnModel().getColumn(6).setMinWidth(0);
tbl.getColumnModel().getColumn(6).setMaxWidth(0);
Error message is:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 6
This will remove the column from the model, i.e, from the user’s view but still be accessible using the index value. I use this all the time and it works perfectly