JOptionPane displaying HTML problems in Java

前端 未结 2 1528
醉话见心
醉话见心 2020-12-06 23:40

Okay, so I have this code, it prompts a month and a year from the user and prints the calendar for that month. I\'m having some problems though.

  1. the HTML fon
2条回答
  •  臣服心动
    2020-12-07 00:24

    There are a couple issues I noticed. For one, instead of getting your own days in the month or leap year info, you could use the java.util.Calendar class, which will do that for you.

    Also, \n newlines don't behave well when interspersed with HTML formatting, so try using < br/> instead. This is causing the font choice to work improperly.

    It looks like extra spaces also get stripped, so surrounding everything with a < pre> tag will fix that.

提交回复
热议问题