Java万年历应用程序,有需要请下载。
for (int i = day_week; i < day_week + days; i++, count++) {
if (i % 7 == 0 || i == 6 || i == 13 || i == 20 || i == 27
|| i == 34 || i == 41) {
/**
* 将跟今天一样的日期用蓝色标示
*/
if (i == day_week + nowDate.getDate() - 1) {
buttonDay[i].setForeground(Color.BLUE);
buttonDay[i].setText(count + "");
} else {
/**
* 其他边界上的按钮中的文字用红色
*/
buttonDay[i].setForeground(Color.RED);
buttonDay[i].setText(count + "");
}
} else {
if (i == day_week + nowDate.getDate() - 1) {
buttonDay[i].setForeground(Color.BLUE);
buttonDay[i].setText(count + "");
} else {
/**
* 一般位置的按钮上的文字用黑色标示
*/
buttonDay[i].setForeground(Color.BLACK);
buttonDay[i].setText(count + "");
}
}
}