title: Difference between initialization of array with two dimensions
body: <p>In my JPanel I am using tablelayout.jar Oracle library (have a look <a href="http://www.oracle.com/technetwork/java/tablelayout-141489.html" rel="nofollow">here</a>) and so, generally, I have to do the following:</p>
  
  <pre><code>private double[][] size = {
          {30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30},
          {30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30}
  };
  JPanel p = new JPanel();
  p.setLayout(new TableLayout(size));
  </code></pre>
  
  <p>where "30" is the dimension respectively for cos and rows. In this case we wanted square cells. So I can do, for example,:</p>
  
  <pre><code>p.add(new JButton(), "1,4" /*"col,row"*/);
  </code></pre>
  
  <p>We thought that declaring that "size" matrix like that was not good to do and so we changed the initialization like the following:</p>
  
  <pre><code>size = new double[Constants.GUI_ROWS][Constants.GUI_COLS];
  for (int i=0; i&lt;Constants.GUI_COLS-1; i++) 
    for (int j=0; j&lt;Constants.GUI_ROWS-1; j++)
      size[i][j] = 30;
  </code></pre>
  
  <p>where </p>
  
  <pre><code>Constants.GUI_COLS = 19 ({30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30}) 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>Constants.GUI_ROWS = 17 ({30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30})
  </code></pre>
  
  <p>but this does not work. When we try to add something to the JPanel then nothing is shown. It works only if we write the first initialization by hand. Why this?</p>