aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Changing the column name in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Changing the column name in JTable" Watch "Changing the column name in JTable" New topic
Author

Changing the column name in JTable

Sowjanya Chowdary
Ranch Hand

Joined: Aug 22, 2005
Posts: 35
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

Joined: Jul 11, 2001
Posts: 14112
Moving to Swing/AWT...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
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.


bitguru blog
Sowjanya Chowdary
Ranch Hand

Joined: Aug 22, 2005
Posts: 35
Michael & Brian,
Thanks for a simple and self-explanatory example.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing the column name in JTable