title: Trying to get two dimensional Array in JTable in JScrollPanel Java
body: <p>My plan is to get a 2-dimensional array into a JTable into a JScrollPanel. The Table already shows the 2-dimensional array's data. The problem is that the table won't show when I add it to a jscrollpanel (The scrollpanel is visible though but empty. It does work when I put the table in the JPanel (not jscrollpanel). but not when using a jscrollpanel.</p>
  
  <p>Does any one have any idea?</p>
  
  <pre><code>package arraytablestable;
  
  import java.awt.*;
  import javax.swing.*;
  import javax.swing.table.*;
  
  public class ArrayTablesTable extends JFrame {
  public static JFrame frame;
  
  
  public static void main(String[] args) {    
  
      frame = new JFrame();
      frame.setSize(1280,720);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setTitle("Array Table 7 in Tables");
      frame.setContentPane(new Paneel());
      frame.setVisible(true);
  }
  
  private static class Paneel extends JPanel {
  
      // Declareren
      public static JTable Table;
  
      public JTableHeader tblHeader;
      public TableModel tblModel;
      public Object[] columnNames;
      public static Object[][] Data;
      public int Resultaat, a ,i ;
      public JScrollPane jScrollPane;
  
  
  
      public Paneel() {
      this.setLayout(new GridLayout(1,1));
      // Initialiseren
      Data = new Object[200][1];
      columnNames = new Object[]{"Product","Resultaat"};
  
  
      // Model maken &amp; importen
      tblModel = new DefaultTableModel(columnNames,0);
      Table = new JTable(tblModel);
  
      // Table Eigenschaooen
  //      tblHeader = Table.getTableHeader();     
  //      tblHeader.setBackground(Color.decode("#a181a1"));
  //      tblHeader.setForeground(Color.decode("#1b1b1b"));
  //      Table.setFocusable(false);
  //      Table.setRowSelectionAllowed(false);
  
      Data[0] = new String[100];
      Data[1] = new Integer[100];
  
  
  
      // For Loop
          for(i = 0; i &lt; 100; i++){ 
          Data[0][i]= "7 x " + i;
          Resultaat = 7 * i;
          Data[1][i]= Resultaat;
  
          TabelVullen(new Object[]{Data[0][i],Data[1][i]});
  
      }
  
          System.out.println("object: " + Data[0][4]);
  
          this.add(jScrollPane);
  
      }
      public void TabelVullen(Object[] data){
      ((DefaultTableModel)Table.getModel()).addRow(data);
  
      // Components -&gt; Panel
  
         jScrollPane = new JScrollPane(Table);
         jScrollPane.add(Table);
  
  
      }
  }
  }
  </code></pre>