This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reordering Column

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eddie Vanda
Ranch Hand
Posts: 281
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.I have a table Model extending Abstract Table Model.Still it is Changing.
 
Eddie Vanda
Ranch Hand
Posts: 281
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic