Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable ....renaming a column Header  RSS feed

 
jite eghagha
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
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!