Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

JTable ....renaming a column Header

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm trying to set my Jtable headers to "Editable". However i've been unable to find an appropriate method.

I've found some code online, but it's old (1999), and far to lengthy for what i assume shouldn't be a "complex" task.
JTable Header

I'd appreciate any advise on how to handle editing column Headers.

thanks
 
Sheriff
Posts: 22014
108
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to disappoint you, but the way a JTable is created it is quite complex indeed. You already found a perfectly good solution.

If you think this is too complex you could check out setting a TableCellRenderer that uses a JTextField for the JTableHeader, but you will also need a TableModel that supports setting the column names.

Furthermore, moving to Swing.
 
reply
    Bookmark Topic Watch Topic
  • New Topic