title: Java JTable setting Column Width
body: <p>I have a JTable in which I set the column size as follows:</p>
  
  <pre><code>table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  table.getColumnModel().getColumn(0).setPreferredWidth(27);
  table.getColumnModel().getColumn(1).setPreferredWidth(120);
  table.getColumnModel().getColumn(2).setPreferredWidth(100);
  table.getColumnModel().getColumn(3).setPreferredWidth(90);
  table.getColumnModel().getColumn(4).setPreferredWidth(90);
  table.getColumnModel().getColumn(6).setPreferredWidth(120);
  table.getColumnModel().getColumn(7).setPreferredWidth(100);
  table.getColumnModel().getColumn(8).setPreferredWidth(95);
  table.getColumnModel().getColumn(9).setPreferredWidth(40);
  table.getColumnModel().getColumn(10).setPreferredWidth(400);
  </code></pre>
  
  <p>This works fine, but when the table is maximized, I get empty space to the right of the last column. Is it possible to make the last column resize to the end of the window when resized?</p>
  
  <p>I found <code>AUTO_RESIZE_LAST_COLUMN</code> property in docs but it does not work.</p>
  
  <p>Edit: <code>JTable</code> is in a <code>JScrollPane</code> its prefered size is set.</p>