package gui.panels.agenda;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class CalendarPane extends JPanel {

	GregorianCalendar cal = new GregorianCalendar();
	private static String[] MONTHS_NL = new String[] { "Januari", "Febuari",
			"Maart", "April", "Mei", "Juni", "Juli", "September",
			"October", "November", "December" };

	public static void main(String[] args) {

		JPanel calendar = new CalendarPane();
	}

	public CalendarPane() {

		JFrame frame = new JFrame("Test calender");
		JPanel main = new JPanel();
		main.setLayout(new BorderLayout());
		frame.add(main);
		// buttons & buttons panel
		JPanel buttons = new JPanel();
		System.out.println("Maand: " + (cal.get(Calendar.MONTH)+1));
		JLabel month = new JLabel(MONTHS_NL[cal.get(Calendar.MONTH)]);
		JButton left = new JButton("Back");
		JButton right = new JButton("Next");
		buttons.add(left);
		buttons.add(month);
		buttons.add(right);
		main.add(buttons, BorderLayout.NORTH);
		this.setOpaque(true);
		this.setBackground(Color.WHITE);
		JLabel mon = new JLabel("Ma");
		JLabel di = new JLabel("Di");
		JLabel wo = new JLabel("Wo");
		JLabel don = new JLabel("Do");
		JLabel vri = new JLabel("Vr");
		JLabel za = new JLabel("Za");
		JLabel zo = new JLabel("Zo");
		JPanel day = new JPanel();
		day.setLayout(new GridLayout(0, 7));
		day.add(mon);
		day.add(di);
		day.add(wo);
		day.add(don);
		day.add(vri);
		day.add(za);
		day.add(zo);

		// Calendar pane
		JPanel days = new JPanel();
		days.setLayout(new BorderLayout());
		main.add(days, BorderLayout.CENTER);
		JPanel calendar = new JPanel();
		days.add(day, BorderLayout.NORTH);

		calendar.setLayout(new GridLayout(6, 7));
		days.add(calendar, BorderLayout.CENTER);

		int axi = cal.getFirstDayOfWeek();
		for (int a = 0; a < 42; a++) {
			if (axi == 32) {
				axi = 1;
			}
			String strI = String.valueOf(axi);
			JLabel label = new JLabel(strI);
			calendar.add(label);
			axi++;

		}
		frame.pack();
		frame.setVisible(true);
	}

}
