Inserting a column into JTable



Hello,

I am currently facing unexpected problems when trying to insert a column
into an instance of JTable:


// Getting the selected column
int col = myTab.getSelectedColumn();
// adding a column to the instance of DefaulTableModel
detMod.addColumn("");
// moving the column to the right place (in the view only)
myTab.getColumnModel().moveColumn(myTab.getColumnCount()-1,col);

This code above only modifies the view, not the model.

myTab.convertColumnIndexToModel(col);

just shows me the mapping. I would like to avoid moving the cells by
hand, can anyone give me a hint on maybe how to modify the mapping?


Uwe
.



Relevant Pages