Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable

 
zoe goddard
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable. When a row is clicked on I want to be able to get the value of column "A". This works. The problem occurs when the user moves the column "A" around, such that the order would be "B", "C", "A", "D". I tried this :

table.getValueAt(table.getSelectedRow(),
table.getColumn("A").getModelIndex());
The problem is that the model index for "A" is always 0.
table.getValue at appears to be using the column number to refer to how the columns appear on the screen.
How would I be able to get the value I want?
Any ideas?

[This message has been edited by zoe goddard (edited June 04, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic