外交礼仪

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

课程设计报告JAVA程序设计——包含多个实例(让你更加容易学习知识、找到自己想要的东西)第一个:一个比较综合的阴历和阳历的java源程序/************************************阴历及节日程序2008beta1免费软件(FreeSoftware)你可以无限传播与反编译该日历有三种外观样式,有从1900年至2049年间的所有阴历个人爱好开发作者:朱春Email:npuxbd@163.comCopyright@2008-AllRightsReservedFileName:Simple_Calendar**********************************/importjava.text.*;importjava.awt.*;importjavax.swing.*;importjava.awt.event.*;importjavax.swing.border.*;importjava.util.*;importjavax.swing.*;publicclassSimpleCalendarextendsJFrameimplementsActionListener{publicstaticvoidmain(String[]args){SwingConsole.run(newSimple_Calendar(),525,525);}publicSimple_Calendar(){setTitle(阴历及节日软件2008beta1);setIconImage(this.getToolkit().createImage(title.gif));setResizable(false);calendar=Calendar.getInstance();today=calendar.get(Calendar.DAY_OF_MONTH);panel_Header=initializtion_Header();panel_Week=initializtion_Week();panel_Calendar=initializtion_Calendar();setLayout(null);setBounds(185,125,0,0);add(panel_Header);panel_Calendar.setBounds(0,0,525,45);课程设计报告add(panel_Week);panel_Week.setBounds(0,45,525,35);add(panel_Calendar);panel_Calendar.setBounds(0,80,525,415);initializtion_Data(calendar);}privateJPanelinitializtion_Header(){//显示表头的panelJPanelpanel=newJPanel();year_box=newJComboBox();month_box=newJComboBox();cross=newJRadioButton(c,false);cross.addActionListener(newLookAndFeel_Listener());system=newJRadioButton(s,false);system.addActionListener(newLookAndFeel_Listener());motif=newJRadioButton(m,false);motif.addActionListener(newLookAndFeel_Listener());feel_group=newButtonGroup();show_help=newJButton(说明);show_help.addActionListener(newStatement_Listener());feel_group.add(cross);feel_group.add(system);feel_group.add(motif);panel.setBorder(newEtchedBorder(5,Color.red,Color.BLUE));JLabelyear_l=newJLabel(请您选择年份:,JLabel.RIGHT);JLabelmonth_l=newJLabel(月份:,JLabel.RIGHT);panel.setLayout(null);panel.setSize(525,45);for(inti=1900;i2050;i++)year_box.addItem(+i);for(intj=1;j=12;j++)month_box.addItem(+j);year_box.setSelectedIndex(calendar.get(Calendar.YEAR)-1900);month_box.setSelectedIndex(calendar.get(Calendar.MONTH));panel.add(year_l);year_l.setBounds(0,10,95,25);panel.add(year_box);year_box.setBounds(100,10,65,25);panel.add(month_l);month_l.setBounds(160,10,45,25);panel.add(month_box);month_box.setBounds(210,10,45,25);JLabellook_feel=newJLabel(外观:,JLabel.RIGHT);panel.add(look_feel);look_feel.setBounds(290-38,10,38,25);panel.add(cross);cross.setBounds(290,10,38,25);panel.add(system);system.setBounds(325,10,32,25);panel.add(motif);motif.setBounds(355,10,38,25);panel.add(show_help);show_help.setBounds(400,10,65,25);show_help.setBorder(newEmptyBorder(0,0,0,0));show_help.setBackground(Color.getHSBColor(23,21,10));year_box.addActionListener(this);课程设计报告month_box.addActionListener(this);returnpanel;}privateJPanelinitializtion_Week(){//显示星期的panelJPanelpanel=newJPanel();panel.setLayout(newGridLayout(1,7));StringcolumnNames[]={星期日,星期一,星期二,星期三,星期四,星期五,星期六};JLabellabel=null;for(inti=0;i7;i++){label=newJLabel(columnNames[i],JLabel.CENTER);if(i==0||i==6)label.setForeground(Color.RED);label.setBorder(newLineBorder(Color.BLUE));panel.add(label);}returnpanel;}privateJPanelinitializtion_Calendar(){//显示日期的panelJPanelpanel=newJPanel();panel.setLayout(newGridLayout(6,7));for(inti=0;i6;i++){for(intj=0;j7;j++){label=newJLabel(,JLabel.CENTER);datas[i][j]=label;label.setBorder(newLineBorder(Color.BLUE));if(j==0||j==6)label.setForeground(Color.RED);datas[i][j].addMouseListener(newList_MouseListener());panel.add(label);}}returnpanel;}publicvoidclear_Data(){//清空内容的for(inti=0;i6;i++)for(intj=0;j7;j++){datas[i][j].setText();if(j==0||j==6)课程设计报告datas[i][j].setForeground(Color.RED);elsedatas[i][j].setForeground(null);}}publicvoidinitializtion_Data(Calendarcalendar){//初始化函数/*节日和纪念日格式:起始年(yyyy)+月(mm)+日(dd)0000表示起始年不明*/HashMapString,StringsFestival=newHashMapString,String();//String[]sFestival_={sFestival.put(0101,元旦);sFestival.put(0214,情人节);sFestival.put(0308,妇女节);sFestival.put(0312,植树节);sFestival.put(0401,愚人节);sFestival.put(0501,劳动节);sFestival.put(0504,青年节);sFestival.put(0601,儿童节);sFestival.put(0701,建党节);sFestival.put(0801,建军节);sFestival.put(0910,教师节);sFestival.put(1001,国庆节);sFestival.put(1031,万圣节);sFestival.put(1112,孙中山诞辰);sFestival.put(1225,圣诞节);sFestival.put(1226,毛泽东诞辰);//};//某月第几个星期几//起始年(4位)+月(2位)+第几个(1位)+星期几(1位)HashMapString,StringwFestival=newHashMapString,String();//String[]wFestival={wFestival.put(0520,母亲节);wFestival.put(0630,父亲节);wFestival.put(1144,感恩节);//};//农历99表示月最后一天HashMapString,StringlFestival=newHashMapString,String();//String[]lFestival={课程设计报告lFestival.put(0101,春节);lFestival.put(0102,大年初二);lFestival.put(0103,大年初三);lFestival.put(0115,元宵节);lFestival.put(0505,端午节);lFestival.put(0707,七夕);lFestival.put(0815,中秋节);lFestival.put(0909,重阳节);lFestival.put(1208,腊八节);lFestival.put(1299,除夕);//};/////////////////////////////////////////////////////////////////////////////////////////////////////////////////this.calendar=calendar;today=calendar.get(Calendar.DAY_OF_MONTH);intmonth=calendar.get(Calen

1 / 91
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功