JOptionPane отображает проблемы HTML в Java

Итак, у меня есть этот код, он запрашивает у пользователя месяц и год и печатает календарь на этот месяц. У меня, однако, есть некоторые проблемы.

the HTML font editing only affects the month. the days of the week are not aligned in columns correctly.

Спасибо!

package calendar_program;

import javax.swing.JOptionPane;

public class Calendar {

public static void main(String[] args) {
    StringBuilder result=new StringBuilder();

    // read input from user
    int year=getYear();
    int month=getMonth();

    String[] allMonths={
            "", "January", "February", "March", "April", "May", "June",
            "July", "August", "September", "October", "November", "December"
    };

    int[] numOfDays= {0,31,28,31,30,31,30,31,31,30,31,30,31};

    if (month == 2 && isLeapYear(year)) numOfDays[month]=29;

    result.append("    "+allMonths[month]+ "  "+ year+"\n"+" S  M  Tu  W Th  F  S"+"\n");

    int d= getstartday(month, 1, year);

    for (int i=0; i<d; i++){
        result.append("    ");
                // prints spaces until the start day
    }
    for (int i=1; i<=numOfDays[month];i++){
        String daysSpace=String.format("%4d", i);
        result.append(daysSpace);
        if (((i+d) % 7==0) || (i==numOfDays[month])) result.append("\n");
    }
    //format the final result string
    String finalresult= "<html><font face='Arial'>"+result; 
    JOptionPane.showMessageDialog(null, finalresult);
}

//prompts the user for a year
public static int getYear(){
    int year=0;
    int option=0;
    while(option==JOptionPane.YES_OPTION){
        //Read the next data String data
        String aString = JOptionPane.showInputDialog("Enter the year (YYYY) :");
        year=Integer.parseInt(aString);
        option=JOptionPane.NO_OPTION;
    }
    return year;
}

//prompts the user for a month
public static int getMonth(){
    int month=0;
    int option=0;
    while(option==JOptionPane.YES_OPTION){
        //Read the next data String data
        String aString = JOptionPane.showInputDialog("Enter the month (MM) :");
        month=Integer.parseInt(aString);
        option=JOptionPane.NO_OPTION;
    }
    return month;
}

//This is an equation I found that gives you the start day of each month
public static int getstartday(int m, int d, int y){
    int year = y - (14 - m) / 12;
    int x = year + year/4 - year/100 + year/400;
    int month = m + 12 * ( (14 - m) / 12 ) - 2;
    int num = ( d + x + (31*month)/12) % 7;
    return num;
}

//sees if the year entered is a leap year, false if not, true if yes
public static boolean isLeapYear (int year){
    if ((year % 4 == 0) && (year % 100 != 0)) return true;
    if (year % 400 == 0) return true;
    return false;
}
}

Ответы на вопрос(2)

Ваш ответ на вопрос