• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing the column name in JTable

 
Sowjanya Chowdary
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a table using swings JTable with some columns.
i need to change the column names when i click on a particular button.
How can i achieve my target?
Thanks in advance for any help.
[ October 17, 2005: Message edited by: Amrutha Ch ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing/AWT...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Brian Cole
Author
Ranch Hand
Posts: 908
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Dunn:


Be careful if you allow the user to re-order the columns,
as getColumnModel().getColumn(0) will return the first
column as displayed, not necessarily column zero of your
table model.
 
Sowjanya Chowdary
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael & Brian,
Thanks for a simple and self-explanatory example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic