title: How can I put a control in the JTableHeader of a JTable?
body: <p>Given a <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/table.html" rel="noreferrer"><code>JTable</code></a> with a column of type <code>Boolean.class</code>, the <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editrender" rel="noreferrer"><em>default renderer</em></a> is a <code>JCheckBox</code>. It's easy enough to select individual cells based on a <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/table.html#selection" rel="noreferrer"><em>user selection</em></a>, but it may be convenient to select all or none of the check boxes, too. These <a href="https://stackoverflow.com/questions/7093213/jtableheader-with-jcheckbox-issue">recent</a> <a href="https://stackoverflow.com/questions/7092219/exception-in-thread-awt-eventqueue-0-java-lang-classcastexception-javax-swing">examples</a> mentioned using <code>JCheckBox</code> in the table header, but the implementation was awkward and unappealing. If I don't need to sort the column, how can I put a well-behaved control in the <a href="https://docs.oracle.com/javase/6/docs/api/javax/swing/table/JTableHeader.html" rel="noreferrer"><code>JTableHeader</code></a>?</p>
  
  <p>Addendum: For convenience, I've added my <a href="http://sscce.org/" rel="noreferrer">sscce</a> as an <a href="https://stackoverflow.com/questions/7137786/how-can-i-put-a-control-in-the-jtableheader-of-a-jtable/7137801#7137801">answer</a>, but I'd be pleased to accept an answer that addresses the <em>well-behaved</em> aspect of the problem.</p>