title: Decrementing month from january to december last year in java
body: <p>I'm have a problem going from january back to december I tried various things but im getting the nullexception. i'm using a button and put a mouselistener so everytime i click it, it decreament a month. but after january it won't decrement to december even i change the year before check the month. here's what I did.</p>
  
  <pre><code>    Button btnNewButton = new Button(composite, SWT.NONE);
      btnNewButton.addMouseListener(new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
              moveCalendar("down");
          }
      });
  </code></pre>
  
  <p>then here's my moveCalendar..</p>
  
  <pre><code>public void moveCalendar(String move)
  {
      Calendar cal = GregorianCalendar.getInstance();
      resetBox();
      if(move.equals("down") )
      {
          dummyMonth--;
          if(dummyMonth &lt; 0)
          {
              dummyMonth = 11;
              dummyYear--;
          }
      }
      else
      {
          dummyMonth++;
          if(dummyMonth &gt; 11)
          {
              dummyMonth = 0;
              dummyYear++;
          }
      }
  
      cal.set(Calendar.YEAR,dummyYear);
      setYear(dummyYear);
      cal.set(Calendar.MONTH,dummyMonth);
      setMonth(dummyMonth);
      int dy = getFirstDay(cal.get(Calendar.MONTH),cal.get(Calendar.YEAR));
      int daysMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
      populateCalendar(dy-1,daysMonth,cal.get(Calendar.DAY_OF_MONTH),dummyMonth);
  }
  </code></pre>
  
  <p>I get nullexception.. any suggestion what's happening?</p>