简单日历(加记事本)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
两个实体类分别为Note和Month
Note实体类如下:
package com.wangjing.calendar.pojo;
public class Note {
private int num ;
private int year;
private int month;
private int day;
private String diary;
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public String getDiary() {
return diary;
}
public void setDiary(String diary) {
this.diary = diary;
}
}
Month类如下:
package com.wangjing.calendar.pojo;
public class Month {
//Ô·ÝmonthÓÃÊý×Ö±íʾ
public static final int N_JANUARY = 1;
public static final int N_FEBRUARY = 2;
public static final int N_MARCH = 3;
public static final int N_APRIL = 4;
public static final int N_MAY = 5;
public static final int N_JUNE = 6;
public static final int N_JULY = 7;
public static final int N_AUGUST = 8;
public static final int N_SEPTEMBER = 9;
public static final int N_OCTOBER = 10;
public static final int N_NOVEMBER = 11;
public static final int N_DECEMBER = 12;
private int year;
public Month(int year) {
this.year = year;
}
//Ô·ÝÌìÊý
private int D_JANUARY = 31;
private int D_FEBRUARY = 28;
private int D_MARCH = 31;
private int D_APRIL = 30;
private int D_MAY = 31;
private int D_JUNE = 30;
private int D_JULY = 31;
private int D_AUGUST = 31;
private int D_SEPTEMBER = 30;
private int D_OCTOBER = 31;
private int D_NOVEMBER = 30;
private int D_DECEMBER = 31;
public int getD_JANUARY() {
return D_JANUARY;
}
public int getD_FEBRUARY() {
if ((this.year % 4 == 0 && this.year % 100 != 0) || this.year % 400 == 0) {
return D_FEBRUARY + 1;
}
return D_FEBRUARY;
}
public int getD_MARCH() {
return D_MARCH;
}
public int getD_APRIL() {
return D_APRIL;
}
public int getD_MAY() {
return D_MAY;
}
public int getD_JUNE() {
return D_JUNE;
}
public int getD_JULY() {
return D_JULY;
}
public int getD_AUGUST() {
return D_AUGUST;
}
public int getD_SEPTEMBER() {
return D_SEPTEMBER;
}
public int getD_OCTOBER() {
return D_OCTOBER;
}
public int getD_NOVEMBER() {
return D_NOVEMBER;
}
public int getD_DECEMBER() {
return D_DECEMBER;
}
}
两个工具类是TimeUtils和NoteUtils:
TimeUtils类如下: