title: JTable clickable column header
body: <p>I am trying to make a clickable column header (so that a method would be called whenever one's clicked). 
  <br /> link to image (since I don't have 10 reputation yet) <a href="http://img156.imageshack.us/img156/5764/clickablecolumn.png" rel="nofollow">http://img156.imageshack.us/img156/5764/clickablecolumn.png</a>
  <br />The column header is in red rectangle.
  <br />What I've done so far is responding whenever any column field (such as the one with James, Benny-G and Rokas) is pressed.
  The code:</p>
  
  <pre><code>public void mouseClicked(MouseEvent e)
      {
          System.out.println("Mouse clicked");
          TableColumnModel cModel = table.getColumnModel();//cModel - column model
          int selColumn = cModel.getColumnIndexAtX(e.getX());//gets the selected column by clicked x coordinate
      }
  </code></pre>