Volevo mostraere un tooltip quando viene passato il mouse sopra il nome delle colonne di una jtable
Ho provato questo codice, ma non funziona
Sapete dirmi dov'e' l'errore?

codice:
package jtable;

import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;

//To display a tool tip for a column header, install a mouse motion listener on the header component and change its tool tip based on which column header is under the cursor. 
public class ToolTipForCell {

	public ToolTipForCell() {
		//super();
		int rows = 10;
	    int cols = 5;
	    JTable table = new JTable(rows, cols);
	    
	    JTableHeader header = table.getTableHeader();
	    
	    ColumnHeaderToolTips tips = new ColumnHeaderToolTips();
	    
	    // Assign a tooltip for each of the columns
	    for (int c=0; c<table.getColumnCount(); c++) {
	        TableColumn col = table.getColumnModel().getColumn(c);
	        tips.setToolTip(col, "Col "+c);
	    }
	    header.addMouseMotionListener(tips);
	    
	    JFrame frame = new JFrame();
	    frame.getContentPane().add(table);
	    frame.pack();
	    frame.setLocationRelativeTo(null);
	    frame.setVisible(true);
	}
	    

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new ToolTipForCell();
	}

	class ColumnHeaderToolTips extends MouseMotionAdapter {
        // Current column whose tooltip is being displayed.
        // This variable is used to minimize the calls to setToolTipText().
        TableColumn curCol;
    
        // Maps TableColumn objects to tooltips
        Map tips = new HashMap();
    
        // If tooltip is null, removes any tooltip text.
        public void setToolTip(TableColumn col, String tooltip) {
            if (tooltip == null) {
                tips.remove(col);
            } else {
                tips.put(col, tooltip);
            }
        }
    
        public void mouseMoved(MouseEvent evt) {
        	System.out.println("mouse moved!");
            TableColumn col = null;
            JTableHeader header = (JTableHeader)evt.getSource();
            JTable table = header.getTable();
            TableColumnModel colModel = table.getColumnModel();
            int vColIndex = colModel.getColumnIndexAtX(evt.getX());
    
            // Return if not clicked on any column header
            if (vColIndex >= 0) {
                col = colModel.getColumn(vColIndex);
            }
    
            if (col != curCol) {
                header.setToolTipText((String)tips.get(col));
                curCol = col;
            }
        }
    }

}