title: It is not showing ColumnName in JTable
body: <p>Hello friends this is my program everything is working cool. 
  But I am not able to display the column names at the top of JTable. What changes should I make to show it? And also tell me how to give scroll bars(both vertical,horizontal) to this table.</p>
  
  <p>Thanks in advance..</p>
  
  <p>Report1.Java:</p>
  
  <pre><code>package com.ash;
  
  import java.awt.BorderLayout;
  import java.awt.Color;
  import java.awt.EventQueue;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  import javax.naming.spi.DirStateFactory.Result;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JRootPane;
  import javax.swing.JScrollPane;
  import javax.swing.border.EmptyBorder;
  import javax.swing.table.DefaultTableModel;
  import javax.swing.table.JTableHeader;
  import javax.swing.JButton;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  import javax.swing.JTable;
      public class Report1 extends JFrame {
  
  Object[][] data = null;
  
  
  private JPanel contentPane;
  
  /**
   * Launch the application.
   */
  ResultSet rs,rs1;
  Statement stmt=null;
  int k=0;
  PreparedStatement pr;
  public JTable table;
  
  public static void main(String[] args) {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  Report1 frame = new Report1();
                  frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the frame.
   */
  public Report1() {
      setTitle("Report");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setBounds(100, 100, 953, 616);
      contentPane = new JPanel();
      contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      setContentPane(contentPane);
      contentPane.setLayout(null);
  
      table = new JTable();
      table.setBounds(100, 136, 810, 431);
      contentPane.add(table);
  
      JButton btnNewButton = new JButton("Add");
      btnNewButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
  
  
  
  
              try {
                  NewPatient.con=DbConnPa.getConObj();
              } catch (ClassNotFoundException e) {
                  e.printStackTrace();
              } catch (SQLException e) {
                  e.printStackTrace();
              }
              String sql="SELECT COUNT (*) FROM newpatient1";
              try {
                  pr=NewPatient.con.prepareStatement(sql);
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              try {
                  rs=pr.executeQuery(sql);
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              try {
                  rs.next();
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              int count = 0;
              try {
                  count = rs.getInt(1);
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              System.out.println(count);
  
  
              data= new Object [count][6];
  
  
              try {
                  stmt=NewPatient.con.createStatement();
              } catch (SQLException e2) {
                  // TODO Auto-generated catch block
                  e2.printStackTrace();
              }
  
              String sql1="SELECT * FROM newpatient1";
  
              Object[] columns={"FirstName","LastName","Age","RefDoctor","Sex","RegId"};
  
              try {
                  rs1=stmt.executeQuery(sql1);
              } catch (SQLException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
              }
              try {
  
  
                      while(rs1.next()){
  
                          for(int j=0;j&lt;6;j++){
                              try {
                                  data[k][j]=rs1.getString(j+1);
                                  System.out.println("i="+"j="+j);
                              } catch (SQLException e) {
                                  // TODO Auto-generated catch block
                                  e.printStackTrace();
                              }
                          }
                      k++;}
                  }
  
               catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
  
  
              table.setModel(new DefaultTableModel(data, columns));
  
  
  
          }
      });
      btnNewButton.setBounds(382, 47, 89, 23);
      contentPane.add(btnNewButton);
  
  
  }
     }
  </code></pre>