|
|
@@ -13,9 +13,9 @@ 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" };
|
|
|
+ private static String[] MONTHS_NL = new String[] { "Januari", "Februari",
|
|
|
+ "Maart", "April", "Mei", "Juni", "Juli", "September",
|
|
|
+ "October", "November", "December" };
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
@@ -31,7 +31,8 @@ public class CalendarPane extends JPanel {
|
|
|
// 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)]);
|
|
|
+ JLabel month = new JLabel(MONTHS_NL [cal.get(Calendar.MONTH)]);
|
|
|
+ System.out.println(cal.get(Calendar.MONTH));
|
|
|
JButton left = new JButton("Back");
|
|
|
JButton right = new JButton("Next");
|
|
|
buttons.add(left);
|
|
|
@@ -67,15 +68,22 @@ public class CalendarPane extends JPanel {
|
|
|
days.add(calendar, BorderLayout.CENTER);
|
|
|
|
|
|
int axi = cal.getFirstDayOfWeek();
|
|
|
- for (int a = 0; a < 42; a++) {
|
|
|
+
|
|
|
+
|
|
|
+ for (int a = 1; a < 42; a++) {
|
|
|
+ if(a >= cal.getFirstDayOfWeek()){
|
|
|
+ String strI = String.valueOf(axi);
|
|
|
+ JLabel label = new JLabel(strI);
|
|
|
+ calendar.add(label);
|
|
|
+ axi++;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ JLabel label = new JLabel();
|
|
|
+ calendar.add(label);
|
|
|
+ }
|
|
|
if (axi == 32) {
|
|
|
axi = 1;
|
|
|
}
|
|
|
- String strI = String.valueOf(axi);
|
|
|
- JLabel label = new JLabel(strI);
|
|
|
- calendar.add(label);
|
|
|
- axi++;
|
|
|
-
|
|
|
}
|
|
|
frame.pack();
|
|
|
frame.setVisible(true);
|