/** @param date */
  public void setSelectedDay(final Date date) {
    selectedDay = CalendarUtil.getCalendar(date, true);
    final DisplayStrategy strategy = contentPane.getStrategy();
    strategy.setIntervalStart(date);
    headerPane.getIntervalLabel().setText(strategy.getDisplayInterval());
    final IntervalChangedEvent event =
        new IntervalChangedEvent(
            JCalendar.this,
            strategy.getType(),
            config.getIntervalStart().getTime(),
            config.getIntervalEnd().getTime());

    for (final IntervalChangedListener listener : intervalChangedListener) {
      listener.intervalChanged(event);
    }
  }
  /** Initializes the GUI */
  private void initGui() {
    this.setBackground(Color.white);
    headerPane = new HeaderPanel(this);
    contentPane = new ContentPanel(this);

    headerPane.getIntervalLabel().setText(contentPane.getStrategy().getDisplayInterval());
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    add(headerPane, c);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 0.9;
    c.insets = new Insets(10, 10, 10, 10);
    add(contentPane, c);
  }
  /** Binds listeners to the components */
  private void bindListeners() {
    final ActionListener strategyActionListener =
        new ActionListener() {

          @Override
          public void actionPerformed(final ActionEvent e) {
            final boolean isDay = e.getSource().equals(headerPane.getDayButton());
            final boolean isWeek = e.getSource().equals(headerPane.getWeekButton());
            final DisplayStrategy.Type type = isDay ? Type.DAY : isWeek ? Type.WEEK : Type.MONTH;

            if (getDisplayStrategy() != type) setDisplayStrategy(type, getSelectedDay());
          }
        };

    headerPane.getDayButton().addActionListener(strategyActionListener);
    headerPane.getWeekButton().addActionListener(strategyActionListener);
    headerPane.getMonthButton().addActionListener(strategyActionListener);

    headerPane
        .getScrollLeft()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(final ActionEvent e) {
                final DisplayStrategy strategy = contentPane.getStrategy();
                strategy.moveIntervalLeft();
                headerPane
                    .getIntervalLabel()
                    .setText(contentPane.getStrategy().getDisplayInterval());
                final IntervalChangedEvent event =
                    new IntervalChangedEvent(
                        JCalendar.this,
                        strategy.getType(),
                        config.getIntervalStart().getTime(),
                        config.getIntervalEnd().getTime());

                for (final IntervalChangedListener listener : intervalChangedListener) {
                  listener.intervalChanged(event);
                }
              }
            });

    headerPane
        .getScrollRight()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(final ActionEvent e) {
                final DisplayStrategy strategy = contentPane.getStrategy();
                strategy.moveIntervalRight();
                headerPane
                    .getIntervalLabel()
                    .setText(contentPane.getStrategy().getDisplayInterval());
                final IntervalChangedEvent event =
                    new IntervalChangedEvent(
                        JCalendar.this,
                        strategy.getType(),
                        config.getIntervalStart().getTime(),
                        config.getIntervalEnd().getTime());

                for (final IntervalChangedListener listener : intervalChangedListener) {
                  listener.intervalChanged(event);
                }
              }
            });
  }