title: Set columns of JTable in specified order after creation
body: <p>There is a JTable with columns in predifined order. Like</p>
  
  <p>+----------------------+</p>
  
  <p>|id     |    name |age |</p>
  
  <p>I want to move columns in the order (for example name=0, age=1, id=2).</p>
  
  <p>+----------------------+</p>
  
  <p>|name     |    age | id |</p>
  
  <p>How can i achive that?
  JTable has method moveColumns, but unfortunately this is not enough. Assume order is strored in map:.</p>
  
  <pre><code>Map&lt;String, Integer&gt; columnOrder = getOrder();
  for(Map.Entry&lt;String, Integer&gt; e : columnOrder.entrySet()) {
      int columnIndex = jtable.convertColumnIndexToView(jtable.getColumn(e.getKey()).getModelIndex());
      jtable.getColumnModel().moveColumn(columnIndex, e.getValue());
  }
  </code></pre>
  
  <p>This does not work, because moveColumn also moves other columns, so from docu:</p>
  
  <pre><code>void moveColumn(int columnIndex,
            int newIndex)
  </code></pre>
  
  <blockquote>
    <p>Moves the column and its header at columnIndex to newIndex. The old
    column at columnIndex will now be found at newIndex. The column that
    used to be at newIndex is <strong>shifted left or right to make room.</strong></p>
  </blockquote>
  
  <p>Can i (dynamically) somehow put the columns in the exactly same order as in my map?</p>