• Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying row number in JTable : Pls Help  RSS feed

 
Raj Sikka
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JTable with 2 columns(say).
I need to add a third column which should display the row number in it.
How do i display the row number .Is there any API to get the row number of a JTable?
When i remove a row from JTable the row numbers should automatically update.
How should i do?
Pls suggest.
Thanks,
Raj
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to write your TableModel class. If your currently using DefaultTableModel or not specifiy a table model ( DefaultTableModel is used by default.) then you can do something like this :

does that help ?
D.
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raj, please do not post duplicates. Thank you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!