// -*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
// @homepage@

package example;

import java.awt.*;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;

public final class MainPanel extends JPanel {
  private MainPanel() {
    super(new BorderLayout());
    String[] columnNames = {"String", "Integer", "Boolean"};
    Object[][] data = {
      {"aaa", 12, true}, {"bbb", 5, false},
      {"CCC", 92, true}, {"DDD", 0, false}
    };
    TableModel model = new DefaultTableModel(data, columnNames) {
      @Override public Class<?> getColumnClass(int column) {
        return getValueAt(0, column).getClass();
      }
    };
    JTable table = new JTable(model);
    table.setTableHeader(new JTableHeader(table.getColumnModel()) {
      @Override public String getToolTipText(MouseEvent e) {
        int c = columnAtPoint(e.getPoint());
        return getTable().getColumnName(c) + " (12345678901234567890...)";
      }
    });

    add(new JScrollPane(table));
    setPreferredSize(new Dimension(320, 240));
  }

  public static void main(String[] args) {
    EventQueue.invokeLater(MainPanel::createAndShowGui);
  }

  private static void createAndShowGui() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
    }
    JFrame frame = new JFrame("@title@");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(new MainPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
}

@@ -252,16 +252,54 @@
 Header;%0A
+import javax.swing.table.TableColumn;%0A
 import j
@@ -978,17 +978,17 @@
     int 
-c
+i
  = colum
@@ -1010,32 +1010,35 @@
 oint());%0A       
+ //
  return getTable
@@ -1058,41 +1058,159 @@
 ame(
-c
+i
 ) + %22 (
-12345678901234567890...)%22
+...)%22;%0A        TableColumn c = getColumnModel().getColumn(i);%0A        return String.format(%22%25s (width=%25dpx)%22, c.getHeaderValue(), c.getWidth())
 ;%0A  

use Column#getHeaderValue() instead of JTable#getColumnName(idx)