title: JTable set column width to keep all text
body: <p>Okay so I have a jtable in a jscrollpane. Currently the columns are set to a minimum width. If the container is too big for that width to fill the container they get wider. However they will not shrink. To show you what I'm talking about
  <a href="http://i.imgur.com/h8BJI9C.png" rel="nofollow">Image 1</a>
  Here the table has all column headers and cell values visible. The cell width was expanded to fill the container. Upon resizing we get this</p>
  
  <p><a href="http://i.imgur.com/cnWeyPD.png" rel="nofollow">image 2</a></p>
  
  <p>Here the columns have been reduced to their minimum width and as the container can not hold them all the scrollbars have been added. In the second image you can see that the header "Vry long title get smushed" and the cell vlaue "Very long cell data" get reduced and replaced with "...". What I would like to do is change this minimum column width for each column to be long enough that it will never cut off whats in the table. This includes both the cell value and the header. I have only been able to find people asking about one or the other and not both. here is my relevant code.</p>
  
  <pre><code>co[0] = "Vry long title get smushed";
  o[1][1] = "Very long cell data";
  JTable table1 = new JTable(o, co)
          {
              public boolean getScrollableTracksViewportWidth()
              {
                  return getPreferredSize().width &lt; getParent().getWidth();
              }
          };  
      table1.getTableHeader().setReorderingAllowed(false);
      table1.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
      tablePane.setViewportView(table1);
  </code></pre>