| Author |
Reordering Column
|
Mathews P Srampikal
Ranch Hand
Joined: Nov 26, 2002
Posts: 211
|
|
I have a table with columns.I don't want to give head.setReorderingAllowed(false); At the same time if the user swap the column the column 0 become 1 and 1 become 0.What to do to prevent this.I mean it should be in the way it created first.
|
Thanks,
Mathews
|
 |
Eddie Vanda
Ranch Hand
Joined: Mar 18, 2003
Posts: 281
|
|
Hi Matthews If you are not using a table model, then you could use the getColumnIndex (column name) on the table to get the new index of the column and then use that number to reference the column. Much easier is to have a table model (say, DefaultTableModel), as its columns do not change when the table's columns change. Ed
|
The nice thing about Standards is that there are so many to choose from!
|
 |
Mathews P Srampikal
Ranch Hand
Joined: Nov 26, 2002
Posts: 211
|
|
|
Yes.I have a table Model extending Abstract Table Model.Still it is Changing.
|
 |
Eddie Vanda
Ranch Hand
Joined: Mar 18, 2003
Posts: 281
|
|
This little example uses DefaultTableModel which takes care of the data storage. mousePressed c=0,r=0 jt value=a0 dtm value=a0 swapped columns mousePressed c=0,r=0 jt value=b0 dtm value=a0 mousePressed c=1,r=1 jt value=a1 dtm value=b1 So it's ok depending on where you get your cell value from. Not sure if that's helpful but I am interested in exploring this further. I think there is another call that will correct the table column.
|
 |
 |
|
|
subject: Reordering Column
|
|
|