JAVA《万年历系统》课程设计报告附源码(2)
return panel;
label = new JLabel(columnNames[i], JLabel.CENTER); if (i == 0 || i == 6)
label.setForeground(Color.RED);
label.setBorder(new LineBorder(new Color(70, 130, 180))); panel.add(label);
private JPanel initializtion_Calendar() {// 显示日期的panel }
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(6, 7)); for (int i = 0; i < 6; i++) { }
return panel;
for (int j = 0; j < 7; j++) { }
label = new JLabel(\datas[i][j] = label;
label.setBorder(new LineBorder(new Color(70, 130, 180))); if (j == 0 || j == 6)
label.setForeground(Color.RED);
datas[i][j].addMouseListener(new List_MouseListener()); panel.add(label);
public void clear_Data() {// 清空内容的
for (int i = 0; i < 6; i++)
for (int j = 0; j < 7; j++) {
datas[i][j].setText(\
20
计算机与信息工程系 《面向对象程序设计》课程设计报告
}
}
if (j == 0 || j == 6)
datas[i][j].setForeground(Color.RED); else
datas[i][j].setForeground(null);
public void initializtion_Data(Calendar calendar) {// 初始化函数
// ////////////////////////////////////////////////// // ////////////////////////////////////////////////////////// /*
* 节日和纪念日 格式:起始年(yyyy)+月(mm)+日(dd) * * *
* 0000表示起始年不明 */
HashMap
21
计算机与信息工程系 《面向对象程序设计》课程设计报告
sFestival.put(\教师节\sFestival.put(\国庆节\sFestival.put(\万圣节\sFestival.put(\孙中山诞辰\sFestival.put(\圣诞节\sFestival.put(\毛泽东诞辰\// };
// 某月第几个星期几
// 起始年(4位)+月(2位)+第几个(1位)+星期几(1位)
HashMap
wFestival.put(\母亲节\wFestival.put(\父亲节\wFestival.put(\感恩节\// };
// 农历 99表示月最后一天
HashMap
// ///////////////////////////////////////////////////////////
22
计算机与信息工程系 《面向对象程序设计》课程设计报告
// ////////////////////////////////////////////////// this.calendar = calendar;
today = calendar.get(Calendar.DAY_OF_MONTH); int month = calendar.get(Calendar.MONTH); int weekindexDay; int weekindexMonth;
calendar.set(Calendar.DATE, 1);
while (calendar.get(Calendar.MONTH) == month) {
weekindexMonth = calendar.get(Calendar.WEEK_OF_MONTH) - 1; weekindexDay = calendar.get(Calendar.DAY_OF_WEEK) - 1; int day = calendar.get(Calendar.DAY_OF_MONTH); // ///////////////////////////////////////////// String today_, month_;
today_ = day < 10 ? \
month_ = month < 10 ? \Lunar lunar = new Lunar(calendar); String lunar_ = lunar.toString(); // /////////////////////////////////////////
if (null != sFestival.get(month_ + today_))
lunar_ = \
// /////
String wFestival_ = month_ + (weekindexMonth) + (weekindexDay);
if (null != wFestival.get(wFestival_)) { }
if (null != lFestival.get(lunar.numeric_md()))
lunar_ = \//System.out.println(wFestival_);
lunar_ = \
23
计算机与信息工程系 《面向对象程序设计》课程设计报告
// 计算除夕
Calendar temp_calendar = Calendar.getInstance();
temp_calendar.set(calendar.get(Calendar.YEAR), month, day + 1); // temp_calendar.add(Calendar.DAY_OF_MONTH,1); Lunar temp_lunar = new Lunar(temp_calendar); String temp_str = temp_lunar.numeric_md(); if (temp_str.equals(\
lunar_ = \
// /计算除夕结束
// //////////////////////////////////////// String day_str; if (day < 10)
day_str = \
else
day_str = \
day_str += \if (day == today)
datas[weekindexMonth][weekindexDay].setForeground(Color.GREEN); }
public void actionPerformed(ActionEvent e) {// 日期和年份的选择更新 int year = Integer.parseInt(year_box.getSelectedItem().toString()); int month = Integer.parseInt(month_box.getSelectedItem().toString()) - 1;
}
// ///////////////////////////////////////////////
datas[weekindexMonth][weekindexDay].setText(day_str); calendar.add(Calendar.DATE, 1);
calendar.set(year, month, today);
clear_Data();
Initializtion_Data(calendar);
24
计算机与信息工程系 《面向对象程序设计》课程设计报告
息
}
class List_MouseListener implements MouseListener {// 鼠标移入时显示的信
JLabel labe = null;
String weeks[] = { \星期日\星期一\星期二\星期三\星期四\星
期五\星期六\
public String constellation(Calendar cal) {
String[][] con = { { \水瓶座\
{ \双鱼座\白羊座\{ \金牛座\双子座\{ \巨蟹座\狮子座\{ \处女座\天秤座\{ \天蝎座\射手座\{ \摩羯座\
int month = cal.get(Calendar.MONTH) + 1; int today = cal.get(Calendar.DAY_O …… 此处隐藏:5221字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [建筑文档]2018年公需课:专业技术人员创新能力与
- [建筑文档]2013年福建教师招考小学数学历年真题
- [建筑文档]高中信息技术课flash知识点总结 - 图文
- [建筑文档]电工实训 - 图文
- [建筑文档]最高院公告案例分析100篇(民商篇)
- [建筑文档]南开中学高2017级14-15学年(上)期末
- [建筑文档]五粮液集团战略分析
- [建筑文档]鲁教版(2012秋季版)九年级化学 酸碱
- [建筑文档]超星尔雅2017中国哲学概论自整理题库答
- [建筑文档]关于成为海口金盘饮料公司材料独家供货
- [建筑文档]LNG学习资料第一册 基础知识 - 图文
- [建筑文档]四年级品社下册《好大一个家》复习资料
- [建筑文档]现阶段领导权力腐败的特点及发展趋势
- [建筑文档]魏晋南北朝诗歌鉴赏—嵇康
- [建筑文档]坚持追求真爱是理智的行为 正方一辩稿
- [建筑文档]湘西州刑释解教人员帮教安置工作存在的
- [建筑文档]园林工程试题库及答案
- [建筑文档]计算机长期没有向WSUS报告状态
- [建筑文档]日语最新流行语
- [建筑文档]B62-016 景观进场交底专题会议
- 2018年中考语文课内外古诗词鉴赏专题复
- 高考试题研究心得体会
- C语言基础题及答案
- 电气控制及PLC习题及答案
- 都昌小学家长学校汇报材料
- GMAT作文模板正确使用方法
- 俄军办坦克大赛:中国99式有望与豹2A6
- 成本会计练习题
- 酒店餐饮业最流行的5S管理方法
- 2014-2015学年山东省菏泽市高二(下)
- 《黄鹤楼送孟浩然之广陵》教案、说课、
- 2013年结构化学自测题 有答案版
- 2011西安世界园艺博览会游览解说词(附
- 窗口文明单位示范单位创建活动总结
- 2018满分超星尔雅就业课后练习期末答案
- 韶山市城市总体规划-基础资料
- 苏教版第三单元知识点归纳
- 第4章 曲轴模态分析
- 加大查办案件力度的思考
- 武汉CPC导轨介绍




