title: ERROR:Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
body: <p>Am trying to design a calendar using a j table, table model which uses and array list and the Gregorian calendar. i implemented the  setValueAt() in the table model that i use to draw the calendar. but when i run the programme, i get the message:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0. 
  </code></pre>
  
  <p>Can any one help me to fix this error?</p>
  
  <pre><code>    GregorianCalendar cal = new GregorianCalendar(year, month, 1);
      nod = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
      som = cal.get(GregorianCalendar.DAY_OF_WEEK);
  
      //Draw calendar
      for (int i=1; i&lt;=nod; i++){
          int row = (i+som-2)/7;
          int column  =  (i+som-2)%7;
          jTable1.getModel().setValueAt( i, row, column);
  
      }
  }
  
  @Override
  public void setValueAt(Object aValue,  int rowIndex, int columnIndex){
      data1.get(rowIndex).set(columnIndex, aValue.toString());
  }
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I initialized <code>data1</code> by passing a two dimensional arraylist argument to constructor of the tablemodel. </p>
  
  <pre><code>ArrayList &lt;String&gt; column1 = new ArrayList(); 
  ArrayList&lt;ArrayList&lt;String&gt;&gt; data1 = new ArrayList(); 
  public mymodel(ArrayList&lt;ArrayList&lt;String&gt;&gt; d, ArrayList&lt;String&gt; c) { 
      this.column1 = c; 
      this.data1 = d;
  }
  </code></pre>