title: JTable doesn't add header row
body: <p>I try to add header row to my <code>JTable</code> and next put table on panel.<br>
  This is my  sample code : </p>
  
  <pre><code>Map &lt;String, Float&gt; tmpCart = new HashMap&lt;String , Float&gt;();
      MainPanel.removeAll();
      MainPanel.repaint();
      tmpCart = cart.GetMap();
          DefaultTableModel tab = new DefaultTableModel();
          tab.setColumnIdentifiers(new String[] {"Name", "Price"});
              for (String key : tmpCart.keySet())
              tab.addRow(new Object[] {key, tmpCart.get(key)});
          JTable jTab = new JTable(tab);
          jTab.setBounds(10, 10, 200, 200);
          jTab.setBackground(Color.orange);
          jTab.setRowHeight(25);
          JScrollPane pan =new JScrollPane(jTab);
           MainPanel.add(pan);
          // MainPanel.add(jTab);
         // pan.repaint(); 
  </code></pre>
  
  <p>How do I write it properly?</p>
  
  <p>//answer</p>
  
  <p>I try create <code>JTable</code> dynamically, after push button, I want get data from <code>Hashtable</code>, create table and put this table on panel.</p>
  
  <p>First step is remove all components from panel, and next create <code>JTable</code> using data from Hashmap`</p>
  
  <p>full function:</p>
  
  <pre><code>private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {                                           
  Map &lt;String, Float&gt; tmpCart = new HashMap&lt;String , Float&gt;();
  MainPanel.removeAll();
  MainPanel.repaint();
  tmpCart = cart.GetMap();
      DefaultTableModel tab = new DefaultTableModel();
      tab.setColumnIdentifiers(new String[] {"Name", "Price"});
          for (String key : tmpCart.keySet())
          tab.addRow(new Object[] {key, tmpCart.get(key)});
      JTable jTab = new JTable(tab);
      jTab.setBounds(10, 10, 200, 200);
      jTab.setBackground(Color.orange);
      jTab.setRowHeight(25);
  
      // MainPanel.add(pan);
       MainPanel.add(jTab);            
  </code></pre>
  
  <p>} </p>
  
  <p>This code works,  create table and put it  on panel,  but  doesn't set  first  row with  column names   ( text : "Names" and "Price").</p>