title: Name Columns in a JTable
body: <p>I'm working on a program for a little store. When I click the button "Report", it must show a Table, like this one:</p>
  
  <p><img src="https://i.imgur.com/mJNLU.png" alt="enter image description here"></p>
  
  <p>Column names "A", "B"..."N", must be the names of the employees. But I can't figure out how.
  Here is my code:</p>
  
  <pre><code>public void Inform()
  {
      String[] employee;
      String[] product[];
      this.setLayout(null);
  
      Inform=new JTable(nulo, employee.length);
  
       model = new DefaultTableModel() {
  
              private static final long serialVersionUID = 1L;
  
              @Override
              public int getColumnCount() {
                  return 1;
              }
  
              @Override
              public boolean isCellEditable(int row, int col) {
                  return false;
              }
  
              @Override
              public int getRowCount() {
                  return Inform.getRowCount();
              }
          };
  
          headerTable = new JTable(model);
  
         for (int i = 0; i &lt; Inform.getRowCount(); i++) 
              headerTable.setValueAt(product[i], i, 0);
  
  
          headerTable.setShowGrid(false);
          headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
          headerTable.setPreferredScrollableViewportSize(new Dimension(50, 0));
          headerTable.getColumnModel().getColumn(0).setPreferredWidth(50);
  
          scrollPane = new JScrollPane(Inform);
          scrollPane.setRowHeaderView(headerTable);
          scrollPane.setBounds(5,5,500,500);
          scrollPane.setEnabled(false);
          this.add(scrollPane);
  
  
  }
  </code></pre>
  
  <p>Employee and product variates depending how many are entered. nulo is how many products are ready to sell.</p>