public void setAppointments(ArrayList<Appointment> a) {
    System.out.println(a);
    updateWeek();

    for (int i = 0; i < dayList.length; i++) {

      dayList[i].clearList();

      for (int j = 0; j < a.size(); j++) {
        int x = 0;

        String dm = String.valueOf(weeknum) + String.valueOf(y.weeks.get(weeknum)[i]);
        if (DateHelpers.convertFromTimestamp(a.get(j).getStart()).get("day")
                == (y.weeks.get(weeknum)[i])
            && DateHelpers.convertFromTimestamp(a.get(j).getStart()).get("month")
                == y.dayMonth.get(dm)) {

          Appointment app = a.get(j);
          AButton b = new AButton(a.get(j));
          b.addActionListener(this);
          dayList[i].addButton(b);
          x += 1;
        } else {

        }
      }
    }
  }
  private void updateWeek() {
    System.out.println("updating week " + weeknum);
    for (int i = 0; i < weekdays.length; i++) {
      String dm = String.valueOf(weeknum) + String.valueOf(y.weeks.get(weeknum)[i]);
      dayLabels[i].setText(
          "   "
              + weekdays[i]
              + " "
              + String.valueOf(y.weeks.get(weeknum)[i])
              + ". "
              + monthnames[y.dayMonth.get(dm)]);
    }

    firstDay =
        DateHelpers.convertToTimestamp(
            y.year,
            (int)
                (y.dayMonth.get(String.valueOf(weeknum) + String.valueOf(y.weeks.get(weeknum)[0]))),
            (y.weeks.get(weeknum)[0]),
            0,
            0,
            0);
    lastDay =
        DateHelpers.convertToTimestamp(
            y.year,
            (int)
                (y.dayMonth.get(String.valueOf(weeknum) + String.valueOf(y.weeks.get(weeknum)[6]))),
            (y.weeks.get(weeknum)[6]),
            0,
            0,
            0);

    ukenummer.setText("Ukenummer: " + Integer.toString(weeknum));
  }