title: Adding a table to java swing
body: <p>I already have a panel to which I have added buttons and a text area. Now I need to display a table below it . The panel's layout is AbsoluteLayout and if I use the following method to inflate the table it shows up empty</p>
  
  <pre><code>        String data[][] = { { "vinod", "BCA", "A" }, { "Raju", "MCA", "b" },
                  { "Ranjan", "MBA", "c" }, { "Rinku", "BCA", "d" } };
  
          String col[] = { "Name", "Course", "Grade" };
          JTable table = new JTable(data, col);
          table.setLocation(25,343);
          panel.add(table, BorderLayout.CENTER);
  </code></pre>
  
  <p>However when I use setbounds the table display okay but  it takes up more space than it requires and the lines dont show in the empty space and it looks bad. Does anyone know how to set only the x,y location of a table and leave the rest of the positioning (width and height to accommodate just what is required)</p>
  
  <pre><code>String data[][] = { { "vinod", "BCA", "A" }, { "Raju", "MCA", "b" },
          { "Ranjan", "MBA", "c" }, { "Rinku", "BCA", "d" } };
  
  String col[] = { "Name", "Course", "Grade" };
  JTable table = new JTable(data, col);
  table.setBounds(25,343,122,122);
  panel.add(table, BorderLayout.CENTER);
  </code></pre>