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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • 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

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.

Posts: 22014
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.
    Bookmark Topic Watch Topic
  • New Topic