Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jtable Q: How to add a listener when column repositioning in JTable occur?  RSS feed

 
a hui
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I reposition the columns in a table, and add KeyListener the order of the columns in the table remain as originally defined e.g. if column headers are A, B, C
A B C
1 2 3
getValueAt(i,j) will give 1, 2, 3
however when user changes the column order to B, C, A I want to read
getValueAt(i, j) 2, 3, 1 but it doesn't.
It hasn't detected that the order changed and it still gives 1, 2, 3.
Does anyone know how should I add the appropriate listener to detect this kind of change to the table?
Thanks
AH
 
Shyamala Parvathy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by a hui:
when I reposition the columns in a table, and add KeyListener the order of the columns in the table remain as originally defined e.g. if column headers are A, B, C
A B C
1 2 3
getValueAt(i,j) will give 1, 2, 3
however when user changes the column order to B, C, A I want to
read
getValueAt(i, j) 2, 3, 1 but it doesn't.
It hasn't detected that the order changed and it still gives 1, 2, 3.
Does anyone know how should I add the appropriate listener to detect this kind of change to the table?
Thanks
AH

Hi
ColumnMoved function u override .I hope this will help u
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!