hi,
i am using JTable with model as DefaultTableModel,using TableSorter
and adding values into model from database.everything goes fine(Table data
display and sorting),created own TableSorter
thing is that when i am adding column dynamically using
.........code........
DefaultTableModel model = (DefaultTableModel)table.getModel();
TableColumn col = new TableColumn(model.getColumnCount());
//Ensure that auto-create is off
if (table.getAutoCreateColumnsFromModel()) {
throw new
IllegalStateException();
}
col.setHeaderValue(headerLabel);
table.addColumn(col);
model.addColumn(headerLabel.toString(), values);
}
.......
i get ArrayIndexOutOfBoundsException......
java.lang.ArrayIndexOutOfBoundsException: 4 >= 4
at java.util.Vector.elementAt(Vector.java:427)
at javax.swing.table.DefaultTableModel.getValueAt(DefaultTableModel.java:618)
at .....TableSorter.getValueAt(TableSorter.java:248)
Intially i have four columns added by using Vector
and used where data1 is a vector of vector,c is a vector
dataModel.setDataVector(data1, c);
Hope i will get a good debugger
Kriti