日历记事本程序代码
C 万年历及公历农历转换源代码1

scanf("%d.%d.%d",&gyear,&gmonth,&gday); if(gyear%4==0 && gyear%100!=0 || gyear%400==0) months[2]=29; else months[2]=28; /*以下是计算在该公历年的第几天*/
whatday=gPastday[gmonth]+gday; if((gyear%4==0 && gyear%100!=0 || gyear%400==0) && (gmonth>2)) whatday++; /*上如果是闰年和月份大于二则在该公历年的第几天数+1*/ /*计算该年春节在公历年的第几天*/
clrscr();
}
}
getch();
}
/*公历每月前面的天数*/ const int gPastday[13]={0,0,31,59,90,120,151,181,212,243,273,304,334};
months[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
{case 1:printf("
* 1 * "); break;
case 3:printf("
* 3 * "); break;
case 5:printf("
* 5 * "); break;
case 7:printf("
* 7 * "); break;
case 9:printf("
* 9 * ");break;
{
万年历c语言源程序

万年历c语言源程序#include stdio.h #include windows.h #include wincon.h #includestring.h #includestdlib.h #includeconio.h #includetime.h #includemath.h #define NULL 0*****_SCREEN_BUFFER_INFO csbiInfo; extern *****API HWND WINAPI GetConsoleWindow(); time_t T;struct tm * now; int min,sec;int hour,nowyear,nowmonth,nowday; void ti2() { time ( T ); now = localtime ( T ); hour=now-tm_hour%12; min=now-tm_min-15; sec=now-tm_sec-15; }void ti(){ time ( T ); now = localtime ( T ); hour=now-tm_hour; min=now-tm_min; sec=now-tm_sec; nowyear=now-tm_year+1900; nowmonth=now-tm_mon+1; nowday=now-tm_mday; }int yearbak=0; void clock_sz(); int pd( int year);void huizs(int line_head_month); void hzdy(int year,int nowmonth_hz); void menu(); void clear();int main(int argc, char* argv[]) { int x=0; ti();clock_sz(); hzdy(nowyear,nowmonth); menu(); return 0; }void clear() { int i; HWND hwnd; HANDLE hOut; HDC hdc;HBRUSH hbr; COORD pos={1,4}; hwnd=GetConsoleWindow(); hdc = GetDC(hwnd); hOut = GetStdHandle(STD_OUTPUT_HANDLE); hbr= CreateSolidBrush(RGB(0,0,0)); SelectObject(hdc,hbr); Rectangle(hdc,0,65,670,470); SetConsoleCursorPosition(hOut, pos); for(i=0;i i++) printf(“ \n "); SetConsoleCursorPosition(hOut, pos); Rectangle(hdc,0,65,670,470); ReleaseDC(hwnd, hdc); } void menu() { int year=0,xyear=0,x, xy=0,i ; struct re { int top; int left; int right; int bottom; }rt; HWND hwnd; HDC hdc,dc; HBRUSH hbr; COORD pos3_1 = {1, 4},pos3_2= {1, 1},pos = {1, 4},pos2_3 = {1, 6},pos2_4 = {1, 7}; INPUT_RECORD mouseRec; DWORD state = 0, res=0; POINT pt; HPEN pn;HANDLE hOut, hIn;hwnd=GetConsoleWindow();//得到控制台窗口句柄hdc = GetDC(hwnd); //得到画图设备句柄dc = GetDC(hwnd);//画刷hbr= CreateSolidBrush(RGB(255,0,0)); SelectObject(dc,hbr);for(rt.left=20,i=2;ii++) rt[i].left=rt[i-1].left+50;for(rt.right=50,i=2;ii++) rt[i].right=rt[i-1].right+50; //定位按钮for(i=0;ii++) rt[i].top=40; for(i=0;ii++) rt[i].bottom=60;hOut = GetStdHandle(STD_OUTPUT_HANDLE); hIn=GetStdHandle(STD_INPUT_HANDLE);pn=CreatePen(PS_SOLID,1,RGB(255,0,255)); GetClientRect(hwnd, rt); SelectObject(hdc, pn);SetBkMode(hdc,*****RENT); MoveToEx(hdc,1,35,NULL); LineTo(hdc,620,35); LineTo(hdc,620,62); LineTo(hdc,1,62); LineTo(hdc,1,35);pn=CreatePen(PS_SOLID,2,RGB(255,255,0));SelectObject(hdc, pn);MoveToEx(hdc,5,75,NULL); LineTo(hdc,45,75);hbr= CreateSolidBrush(RGB(0,0,190)); SelectObject(dc,hbr); for(i=1;ii++) Rectangle(dc,rt[i].left,rt[i].top,rt[i].right,rt[i].bottom);SetTextColor(hdc,RGB(0,255,255));TextOut(hdc,280,10,TEXT("万年历"),6);//输出文本SetTextColor(hdc,RGB(255,255,0));////设颜色TextOut(hdc,rt.left,rt.top,TEXT(" 1"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 2"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 3"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 4"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 5"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 6"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 7"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 8"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 9"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT(" 0"),3);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT("确定"),4);//输出文本TextOut(hdc,rt.left+=50,rt.top,TEXT("清除"),4);//输出文本TextOut(hdc,40,350,TEXT("提示:双击窗口退出"),18);//输出文本SetConsoleCursorPosition(hOut, pos3_1); ShowWindow(hwnd,SW_SHOW); SetConsoleTextAttribute(hOut, 10); for(;;) { SetConsoleTextAttribute(hOut, 10); ReadConsoleInput(hIn, mouseRec, 1, res); Sleep(100); if (mouseRec.EventType == MOUSE_EVENT) { if (mouseRec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK) break; if (mouseRec.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_*****) { GetCursorPos(pt); ScreenToClient(hwnd,pt); if(pt.x20 pt.x50 pt.yrt.top pt.yrt.bottom) { if(xyear4) printf("1"); xyear++; if(xyear==1) year=1*1000; if(xyear==2) year=year+1*100; if(xyear==3) year=year+1*10; if(xyear==4) { year=year+1; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.top pt.yrt.bottom) { if(xyear4) printf("2"); xyear++; if(xyear==1) year=2*1000; if(xyear==2) year=year+2*100;if(xyear==3) year=year+2*10; if(xyear==4){ year=year+2;printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom) { if(xyear4) printf("3"); xyear++; if(xyear==1) year=3*1000; if(xyear==2) year=year+3*100; if(xyear==3) year=year+3*10; if(xyear==4){ year=year+3; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("4"); xyear++; if(xyear==1) year=4*1000; if(xyear==2) year=year+4*100; if(xyear==3) year=year+4*10; if(xyear==4){ year=year+4; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("5"); xyear++; if(xyear==1) year=5*1000; if(xyear==2) year=year+5*100; if(xyear==3) year=year+5*10; if(xyear==4){ year=year+5;pt.yrt.top pt.yrt.top pt.yrt.topprintf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("6"); xyear++; if(xyear==1) year=6*1000; if(xyear==2) year=year+6*100; if(xyear==3) year=year+6*10; if(xyear==4){ year=year+6; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("7"); xyear++; if(xyear==1) year=7*1000; if(xyear==2) year=year+7*100; if(xyear==3) year=year+7*10;if(xyear==4){ year=year+7; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("8"); xyear++; if(xyear==1) year=8*1000; if(xyear==2) year=year+8*100; if(xyear==3) year=year+8*10; if(xyear==4){ year=year+8; printf("\n你选择的年为%d",year);pt.yrt.top pt.yrt.top pt.yrt.top} continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("9"); xyear++; if(xyear==1) year=9*1000; if(xyear==2) year=year+9*100; if(xyear==3) year=year+9*10; if(xyear==4){ year=year+9; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear4) printf("0"); xyear++; if(xyear==1) year=0*1000; if(xyear==2) year=year+0*100; if(xyear==3) year=year+0*10; if(xyear==4){ year=year+0; printf("\n你选择的年为%d",year); } continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.bottom){ if(xyear=1year!=0) { clear(); yearbak=year; SetConsoleCursorPosition(hOut, pos3_2); printf("公元%d年",yearbak); SetConsoleCursorPosition(hOut, pos3_1); for(i=1;ii+=3) huizs(i);pt.yrt.top pt.yrt.top pt.yrt.topx=MessageBox(NULL,"是否显示后六个月?", "提示",MB_YESNO); if(x==6) { SetConsoleTextAttribute(hOut, 14); clear(); for(i=7;ii+=3) huizs(i); } } else printf("输入不合法,请点击清除重新输入"); continue; } else if(pt.xrt.left pt.xrt.right pt.yrt.top pt.yrt.bottom){ xyear=0; year=0; clear(); clock_sz(); hzdy(nowyear,nowmonth);pn=CreatePen(PS_SOLID,2,RGB(255,255,0)); SelectObject(hdc, pn);//选画笔MoveToEx(hdc,5,75,NULL); LineTo(hdc,45,75); SetConsoleCursorPosition(hOut, pos); continue; } }; } } ReleaseDC(hwnd,hdc); }int pd( int year) { int pr=0; if((year%100==0)(year%400==0)) pr=1; else if(year%4==0year%100!=0) pr=1; else pr=0; return pr; } void huizs(int line_head_month) { int i=0,j=0,k=0,month=0,n=0,daysum=0,jlw=0;int monthhead={0},mlt={1,1,1}; int endline=0,test=0; int year=0; year=yearbak; for(i=1;iyear;i++) { if(pd(i)) daysum+=366; else daysum+=365; } j=daysum%7; monthhead=j; for(month=1;monthmonth++) { if(pd(year)month==2) n=29; else if(pd(year)==0month==2) n=28; else if(month==4||month==6||month==9||month==11) n=30; else n=31; monthhead[month]=(monthhead[month-1]+n)%7; } while(test=5){ for(month=line_head_month;month=(line_head_month+2);mo nth++) { if(month%3==1endline==0) { printf("\t%d月\t\t\t%d月\n",month,month+1,month+2); printf("一二三四五六日一二三四五六日三四五六日\n"); } if(endline==0) { for(k=0;kmonthhead[month-1];k++) printf(" "); j=monthhead[month-1]; } if(endline==0) i=1; else i=mlt[month-1]; for(;ji++,j++) { if(pd(year)month==2) n=29; else if(pd(year)==0month==2) n=28;%d月一二else if(month==4||month==6||month==9||month==11) n=30; else n=31; if(in) { for(k=0;kk++) printf(" "); break; } printf("%-3.0d",i); } printf(" "); mlt[month-1]=i; if(month%3==0) { printf("\n"); endline=1; } j=0; } test++; } }void hzdy(int year,int nowmonth_hz) { int i=0,j=0,k=0,month=0,n=0,daysum=0,jlw=0; int monthhead={0},mlt={1,1,1}; int endline=0,test=0; for(i=1;iyear;i++) { if(pd(i)) daysum+=366; else daysum+=365; } j=daysum%7; monthhead=j; for(month=1;monthmonth++) { if(pd(year)month==2) n=29; else if(pd(year)==0month==2) n=28;//平年else if(month==4||month==6||month==9||month==11) n=30; elsen=31; monthhead[month]=(monthhead[month-1]+n)%7; } if(pd(year)nowmonth_hz==2) n=29;//闰年else if(pd(year)==0nowmonth_hz==2) n=28;//平年else if(nowmonth_hz==4||nowmonth_hz==6||nowmonth_hz==9||no wmonth_hz==11) n=30;//4,6,9,11月else n=31; printf("\n\n\n\n\n\n\n\n 当前时间:%d年%d月%d日%d时%d分\n\n",nowyear,nowmonth,nowday,hour,min); printf("\t一二三四五六日\n\t"); for(k=0;kmonthhead[nowmonth_hz-1];k++) printf(" "); j=monthhead[nowmonth_hz-1]; for(i=1;ii++,j++) { if(j==7) { printf("\n\t"); j=0; } printf("%-3.0d",i); } printf("\n"); } void clock_sz() { float a,b,c; float x=0,y=0,ex=100,ey=160,radian=0,oldx,oldy,radius=90; float mx=0,my=0,oldmx,oldmy,mradius=40; float hx=0,hy=0,oldhx,oldhy,hradius=20; intkd_r1,kd_r2,kd_radius=170,kd_radius1,old_kd_x,old_kd_y,kd_radi an=0,k=0,q=0,oldk,oldq; HWND hwnd; HANDLE hOut; HDC hdc; *****F C1=RGB(0,0,0),C2=RGB(0,0,0); HBRUSH hbr,hbr1,hbr2; HPENhpn,gpn,rpn,ppn2,ypn,bpn,kdpn,rkdpn,dotpn,blue,black,blkdpn, pkdpn,hpn2; hwnd=GetConsoleWindow(); hdc = GetDC(hwnd);hOut = GetStdHandle(STD_OUTPUT_HANDLE); hbr= CreateSolidBrush(RGB(0,100,0)); hbr1= CreateSolidBrush(C1); hbr2= CreateSolidBrush(RGB(0,0,150)); hpn2=CreatePen(PS_SOLID,1,RGB(255,0,0));rpn=CreatePen(PS_SOLID,1,RGB(255,0,0));hpn=CreatePen(PS_SOLID,1,RGB(0,255,255));blue=CreatePen(PS_SOLID,3,RGB(0,0,255));bpn=CreatePen(PS_SOLID,1,RGB(255,255,255));gpn=CreatePen(PS_SOLID,2,RGB(0,255,0));pkdpn=CreatePen(PS_SOLID,3,RGB(0,255,255));kdpn=CreatePen(PS_SOLID,1,RGB(255,255,0));rkdpn=CreatePen(PS_SOLID,4,RGB(255,0,0));blkdpn=CreatePen(PS_SOLID,6,RGB(0,0,0));black=CreatePen(PS_SOLID,4,C1); ex=400;//时钟圆心位置ey=230;while(kd_radian=360){ if(kd_radian%5==0) { if(kd_radian%90==0){ kd_radius=130; SelectObject(hdc,rkdpn); } else{ kd_radius=125; SelectObject(hdc,pkdpn); } } else { kd_radius=130; SelectObject(hdc, kdpn); kd_radius1=120; } y=kd_radius*sin(kd_radian/180.0*3.14);x=kd_radius*cos(kd_radian/180.0*3.14);MoveToEx(hdc,ex,ey,NULL); LineTo(hdc,ex+x,ey+y); y=kd_radius1*sin(kd_radian/180.0*3.14);x=kd_radius1*cos(kd_radian/180.0*3.14); old_kd_x=x; old_kd_y=y; SelectObject(hdc,blkdpn); MoveToEx(hdc,ex,ey,NULL); LineTo(hdc,ex+old_kd_x,ey+old_kd_y); kd_radian+=6; };SetTextColor(hdc,RGB(0,255,0));}TextOut(hdc,ex+kd_radius+8,ey-7,TEXT("3"),1);TextOut(hdc,ex-4,ey+kd_radius+3,TEXT("6"),1); TextOut(hdc,ex-kd_radius-15,ey-5,TEXT("9"),1); TextOut(hdc,ex-7,ey-kd_radius-18,TEXT("12"),2); radius=110;mradius=90;//分针半径hradius=70;//时针半径x=0,y=0; radian=0;SetTextColor(hdc,RGB(0,255,225));////设颜色SetBkColor(hdc,RGB(0,0,0));////设颜色ti2();a=sec*6/180.0*3.14; b=min*6/180.0*3.14;c=(hour*30.0-90.0+(min+15)/2.0)/180.0*3.14; SetTextColor(hdc,RGB(0,255,255)); my=mradius*sin(b); mx=mradius*cos(b); SelectObject(hdc, gpn);MoveToEx(hdc,ex,ey,NULL); LineTo(hdc,ex+mx,ey+my); LineTo(hdc,ex+mx,ey+my); hy=hradius*sin(c); hx=hradius*cos(c);SelectObject(hdc, blue);MoveToEx(hdc,ex,ey,NULL); LineTo(hdc,ex+hx,ey+hy); ReleaseDC(hwnd, hdc);。
Java万年历源代码,可显示公历、农历、系统时间、国际时间

import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.table.DefaultTableModel;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import java.util.Locale;import java.util.TimeZone;public class wannianli extends JFrame implements ActionListener, MouseListener {private Calendar cld = Calendar.getInstance();//获取一个Calendar类的实例对象private String[] astr = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };private DefaultTableModel dtm = new DefaultTableModel(null, astr);private JTable table = new JTable(dtm);private JScrollPane sp = new JScrollPane(table);private JButton bLastYear = new JButton("上一年");private JButton bNextYear = new JButton("下一年");private JButton bLastMonth = new JButton("上月");private JButton bNextMonth = new JButton("下月");private JPanel p1 = new JPanel(); // 设立八个中间容器,装入布局控制日期的按钮模块private JPanel p2 = new JPanel(new GridLayout(3,2));//网格布局private JPanel p3 = new JPanel(new BorderLayout());//边界布局private JPanel p4 = new JPanel(new GridLayout(2,1));private JPanel p5 = new JPanel(new BorderLayout());private JPanel p6 = new JPanel(new GridLayout(2,2));private JPanel p7 = new JPanel(new GridLayout(2,1));private JPanel p8 = new JPanel(new BorderLayout());private JComboBox timeBox = newJComboBox(TimeZone.getAvailableIDs());//对所有支持时区进行迭代,获取所有的id;private JTextField jtfYear = new JTextField(5);// jtfYeaar年份显示输入框private JTextField jtfMonth = new JTextField(2);// jtfMouth月份显示输入框private JTextField timeField=new JTextField();//各城市时间显示框private static JTextArea jta = new JTextArea(10,5);//农历显示区private JScrollPane jsp = new JScrollPane(jta);private JLabel l = new JLabel("花江小精灵:亲!你可以直接输入年月查询.");private JLabel lt = new JLabel();private JLabel ld = new JLabel();private JLabel lu = new JLabel("农历和节气");private JLabel null1=new JLabel();private int lastTime;//private String localTime = null;private String s = null;private SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy年MM月dd 日 hh时mm分ss秒");public wannianli() {super("花江日历过去仅留追忆,未来刚生憧憬,唯有坚守本心,把握今天 ZYT 詹永堂 ");// 框架命名this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 窗口关闭函数this.getContentPane().setLayout(new BorderLayout(9, 10));jta.setLineWrap(true);// 长度大于分配长度时候则换行jta.setFont(new Font("黑体", Font.BOLD, 16));table.setBackground(Color.white);table.setGridColor(Color.pink);// 星期之间的网格线是灰色的table.setBackground(Color.white);table.setColumnSelectionAllowed(true);// 将table中的列设置为可选择的table.setSelectionBackground(Color.pink);// 当选定某一天时背景颜色为黑色table.setSelectionForeground(Color.GREEN);table.setBackground(new Color(184,207, 229));// 日期显示表格为浅蓝色table.setFont(new Font("黑体", Font.BOLD, 24));// 日期数字字体格式table.setRowHeight(26);// 表格的高度table.addMouseListener(this); // 鼠标监听器、lu.setFont(new Font("黑体", Font.BOLD, 22));//农历标签格氏jtfYear.addActionListener(this);// 可输入年份的文本框// 为各个按钮添加监听函数bLastYear.addActionListener(this);bNextYear.addActionListener(this);bLastMonth.addActionListener(this);bNextMonth.addActionListener(this);timeBox.addItemListener(new TimeSelectedChangedListener());// 将按钮添加到Jpane上p1.add(bLastYear);p1.add(jtfYear);// 年份输入文本框p1.add(bNextYear);p1.add(bLastMonth);p1.add(jtfMonth);p1.add(bNextMonth);p3.add(jsp, BorderLayout.SOUTH);p3.add(lu,BorderLayout.CENTER);p3.add(ld, BorderLayout.NORTH);p4.add(lt);p4.add(l);p5.add(p4, BorderLayout.SOUTH);p5.add(sp, BorderLayout.CENTER);p5.add(p1, BorderLayout.NORTH);p6.add(timeBox);p6.add(null1);p6.add(timeField);p8.add(p2,BorderLayout.CENTER);p8.add(p7,BorderLayout.SOUTH);this.getContentPane().add(p3, BorderLayout.EAST);this.getContentPane().add(p5, BorderLayout.CENTER);this.getContentPane().add(p6,BorderLayout.SOUTH);this.getContentPane().add(p8,BorderLayout.WEST);String[] strDate = DateFormat.getDateInstance().format(new Date()) .split("-");// 获取日期cld.set(Integer.parseInt(strDate[0]), Integer.parseInt(strDate[1]) - 1,0);showCalendar(Integer.parseInt(strDate[0]),Integer.parseInt(strDate[1]), cld);jtfMonth.setEditable(false);// 设置月份文本框为不可编辑jtfYear.setText(strDate[0]);jtfMonth.setText(strDate[1]);this.showTextArea(strDate[2]);ld.setFont(new Font("新宋体", Font.BOLD, 24));new Timer(lt).start();new TimeThread().start();this.setBounds(200, 200, 700, 350);this.setResizable(false);this.setVisible(true);}public void showCalendar(int localYear, int localMonth, Calendar cld) {int Days = getDaysOfMonth(localYear, localMonth) +cld.get(Calendar.DAY_OF_WEEK) -2;Object [] ai = new Object[7];lastTime = 0;for (int i = cld.get(Calendar.DAY_OF_WEEK)-1; i <= Days; i++) {ai[i%7] =String.valueOf(i-(cld.get(Calendar.DAY_OF_WEEK)-2));if (i%7 == 6){dtm.addRow(ai);ai = new Object[7];lastTime++;}}dtm.addRow(ai);}public int getDaysOfMonth(int Year, int Month) {//计算各月的天数if(Month==1||Month==3||Month==5||Month==7||Month==8||Month==10||Mont h==12){return 31;}if(Month==4||Month==6||Month==9||Month==11){return 30;}if(Year%4==0&&Year%100!=0||Year%400==0)//闰年{return 29;}else {return 28;}}public void actionPerformed(ActionEvent e)//从界面上获取年月数据{if(e.getSource() == jtfYear || e.getSource() == bLastYear || e.getSource() == bNextYear ||e.getSource() == bLastMonth || e.getSource() == bNextMonth){int m, y;try//控制输入的年份正确,异常控制{if (jtfYear.getText().length() != 4){throw new NumberFormatException();}y = Integer.parseInt(jtfYear.getText());m = Integer.parseInt(jtfMonth.getText());}catch (NumberFormatException ex){JOptionPane.showMessageDialog(this, "请输入4位0-9的数字!", "年份有误", JOptionPane.ERROR_MESSAGE);return;}ld.setText("没有选择日期");for (int i = 0; i < lastTime+1; i++){ dtm.removeRow(0);}if(e.getSource() ==bLastYear){ jtfYear.setText(String.valueOf(--y)); }if(e.getSource() ==bNextYear){jtfYear.setText(String.valueOf(++y)); }if(e.getSource() == bLastMonth){if(m == 1){jtfYear.setText(String.valueOf(--y));m = 12;jtfMonth.setText(String.valueOf(m));}else{jtfMonth.setText(String.valueOf(--m));}}if(e.getSource() == bNextMonth){if(m == 12){jtfYear.setText(String.valueOf(++y));m = 1;jtfMonth.setText(String.valueOf(m));}else{jtfMonth.setText(String.valueOf(++m));}}cld.set(y, m-1, 0);showCalendar(y, m, cld);}}public void mouseClicked(MouseEvent e){jta.setText(null);int r = table.getSelectedRow();int c = table.getSelectedColumn();if (table.getValueAt(r,c) == null){ld.setText("没有选择日期");}else{this.showTextArea(table.getValueAt(r,c));}}private void showTextArea(Object selected){ld.setText(jtfYear.getText()+"年"+jtfMonth.getText()+"月"+selected+"日");}public static void main(String[] args){JFrame.setDefaultLookAndFeelDecorated(true);JDialog.setDefaultLookAndFeelDecorated(true);new wannianli();jta.setText(today());}private void updateTimeText(String timeZoneId) {if(timeZoneId != null){TimeZone timeZone = TimeZone.getTimeZone(timeZoneId);dateFormat.setTimeZone(timeZone);Calendar calendar = Calendar.getInstance();calendar.setTimeZone(timeZone);timeField.setText(dateFormat.format(calendar.getTime()));}else{timeField.setText(null);}}private class TimeSelectedChangedListener implements ItemListener { public void itemStateChanged(ItemEvent e) {if (e.getStateChange()==ItemEvent.SELECTED) {if (e.getItem() instanceof String) {s = e.getItem().toString();}}}}private class TimeThread extends Thread{public void run(){while(true){updateTimeText(s);try{Thread.sleep(100);}catch(InterruptedException e){e.printStackTrace();}}}}class Timer extends Thread //显示系统时间{private JLabel lt;private SimpleDateFormat fy = new SimpleDateFormat(" Gyyyy.MM.dd HH:mm:ss ");public Timer(JLabel lt){this.lt=lt;}public void run(){while(true){try{lt.setText(fy.format(new Date()));this.sleep(500);}catch(InterruptedException ex){ex.printStackTrace();}}}}final private static long[] lunarInfo= new long[] { 0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554,0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0,0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566,0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550,0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0,0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263,0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0,0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5,0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0,0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9,0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0,0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520,0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0 };final private static int[] year20 = new int[] { 1, 4, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };final private static int[] year19 = new int[] { 0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 };final private static int[] year2000 = new int[] { 0, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };public final static String[] nStr1 = new String[] { "", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一","十二" };private final static String[] Gan = new String[] { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };private final static String[] Zhi = new String[] { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };private final static String[] Animals = new String[] { "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" };// 传回农历 y年的总天数final private static int lYearDays(int y) {int i, sum = 348;for (i = 0x8000; i > 0x8; i >>= 1) {if ((lunarInfo[y - 1900] & i) != 0)sum += 1;}return (sum + leapDays(y));}// 传回农历 y年闰月的天数final private static int leapDays(int y) {if (leapMonth(y) != 0) {if ((lunarInfo[y - 1900] & 0x10000) != 0)return 30;elsereturn 29;} elsereturn 0;}// 传回农历 y年闰哪个月 1-12 , 没闰传回 0final private static int leapMonth(int y) {return (int) (lunarInfo[y - 1900] & 0xf);}//传回农历 y年m月的总天数final private static int monthDays(int y, int m) {if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)return 29;elsereturn 30;}// 传回农历 y年的生肖final public static String AnimalsYear(int y) {return Animals[(y - 4) % 12];}//传入月日的offset 传回干支,0=甲子final private static String cyclicalm(int num) {return (Gan[num % 10] + Zhi[num % 12]);}// 传入 offset 传回干支, 0=甲子final public static String cyclical(int y) {int num = y - 1900 + 36;return (cyclicalm(num));}// 传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6final private long[] Lunar(int y, int m) {long[] nongDate = new long[7];int i = 0, temp = 0, leap = 0;Date baseDate = new GregorianCalendar(1900 + 1900, 1,31).getTime();Date objDate = new GregorianCalendar(y + 1900, m, 1).getTime();long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;if (y < 2000)offset += year19[m - 1];if (y > 2000)offset += year20[m - 1];if (y == 2000)offset += year2000[m - 1];nongDate[5] = offset + 40;nongDate[4] = 14;for (i = 1900; i < 2050 && offset > 0; i++) {temp = lYearDays(i);offset -= temp;nongDate[4] += 12;}if (offset < 0) {offset += temp;i--;nongDate[4] -= 12;}nongDate[0] = i;nongDate[3] = i - 1864;leap = leapMonth(i); // 闰哪个月nongDate[6] = 0;for (i = 1; i < 13 && offset > 0; i++) {// 闰月if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { --i;nongDate[6] = 1;temp = leapDays((int) nongDate[0]);} else {temp = monthDays((int) nongDate[0], i);}// 解除闰月if (nongDate[6] == 1 && i == (leap + 1))nongDate[6] = 0;offset -= temp;if (nongDate[6] == 0)nongDate[4]++;}if (offset == 0 && leap > 0 && i == leap + 1) {if (nongDate[6] == 1) {nongDate[6] = 0;} else {nongDate[6] = 1;--i;--nongDate[4];}}if (offset < 0) {offset += temp;--i;--nongDate[4];}nongDate[1] = i;nongDate[2] = offset + 1;return nongDate;}// 传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6final public static long[] calElement(int y, int m, int d) {long[] nongDate = new long[7];int i = 0, temp = 0, leap = 0;Date baseDate = new GregorianCalendar(0 + 1900, 0, 31).getTime();Date objDate = new GregorianCalendar(y, m - 1, d).getTime();long offset = (objDate.getTime() - baseDate.getTime()) / 86400000L;nongDate[5] = offset + 40;nongDate[4] = 14;for (i = 1900; i < 2050 && offset > 0; i++) {temp = lYearDays(i);offset -= temp;nongDate[4] += 12;}if (offset < 0) {offset += temp;i--;nongDate[4] -= 12;}nongDate[0] = i;nongDate[3] = i - 1864;leap = leapMonth(i); // 闰哪个月nongDate[6] = 0;for (i = 1; i < 13 && offset > 0; i++) {// 闰月if (leap > 0 && i == (leap + 1) && nongDate[6] == 0) { --i;nongDate[6] = 1;temp = leapDays((int) nongDate[0]);} else {temp = monthDays((int) nongDate[0], i);}// 解除闰月if (nongDate[6] == 1 && i == (leap + 1))nongDate[6] = 0;offset -= temp;if (nongDate[6] == 0)nongDate[4]++;}if (offset == 0 && leap > 0 && i == leap + 1) { if (nongDate[6] == 1) {nongDate[6] = 0;} else {nongDate[6] = 1;--i;--nongDate[4];}}if (offset < 0) {offset += temp;--i;--nongDate[4];}nongDate[1] = i;nongDate[2] = offset + 1;return nongDate;}public final static String getChinaDate(int day) { String a = "";if (day == 10)return"初十";if (day == 20)return"二十";if (day == 30)return"三十";int two = (int) ((day) / 10);if (two == 0)a = "初";if (two == 1)a = "十";if (two == 2)a = "廿";if (two == 3)a = "三";int one = (int) (day % 10);switch (one) {case 1:a += "一";break;case 2:a += "二";break;case 3:a += "三";break;case 4:a += "四";break;case 5:a += "五";break;case 6:a += "六";break;case 7:a += "七";break;case 8:a += "八";break;case 9:a += "九";break;}return a;}public static String today() {Calendar today = Calendar.getInstance(Locale.SIMPLIFIED_CHINESE);int year = today.get(Calendar.YEAR);int month = today.get(Calendar.MONTH) + 1;int date = today.get(Calendar.DATE);long[] l = calElement(year, month, date);StringBuffer sToday = new StringBuffer();try {sToday.append(sdf.format(today.getTime()));sToday.append(" \n");sToday.append(" \n");sToday.append(" \n");sToday.append(" 农历");sToday.append(cyclical(year));sToday.append('(');sToday.append(AnimalsYear(year));sToday.append(")年");sToday.append(" \n");sToday.append(" ");sToday.append(nStr1[(int) l[1]]);sToday.append("月");sToday.append(getChinaDate((int) (l[2])));return sToday.toString();} finally {sToday = null;}}private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy 年M月d日 EEEEE");public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) { }}。
C语言实训--万年历源代码

C语言实训--万年历源代码# include#include#include#include#include# define YEAR 365int numday[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}};int leap(int year);int calday(int y,int m);int counterdays(int year,int month,int day);int week(int year,int month,int day);int eachyeartotal(int year,int month,int day);int maxDay(int y,int month);void print(int y,int m,int w);void festival (int year,int month,int day);int IsLeap(int y);int guanli(int i);void rili(int year,int month);int rili1();void rili2();void rili3();void rili4();void rili5();void fan();void show(int year,int month,int date,int sec,int mini,int hour);int main(){int i;printf("***************************************\n"); printf("1.查询日历,输入年份:\n");printf("2.查询该月日历及对应星期,输入年份和月份:\n"); printf("3.查询星期几及节日,输入年月日:\n");printf("4.距您输入日期还有多少天,输入日期:\n"); printf("5.通过键盘上下控制不同年月日:\n");scanf("%d",&i);guanli(i);return 0;}int guanli(int i){switch(i){case 1:rili1();return main();case 2:rili2();return main();case 3:rili3();return main();case 4:rili4();return main();case 5:rili5();return main();}return 0;}int rili1(){int year;int n,i;printf("输入年份:");scanf("%d",&year);printf("the calendar of the year%d\n",year);printf("\n");printf("=============================\n"); for(i=1;i<13;i++){printf(" %d月份\n",i);rili(year,i);}n = leap(year);return 0;}void rili2(){int year,month,w;printf("输入年月:");scanf("%d%d",&year,&month);w=calday(year,month);print(year,month,w);}void rili3(){int year,month,day,number;printf("输入年月日:");scanf("%d%d%d",&year,&month,&day);festival(year,month,day);number= week(year,month,day);printf("星期%d",number);}void rili4(){int year,month,day;printf("输入年月日:");scanf("%d%d%d",&year,&month,&day); eachyeartotal( year,month,day);counterdays(year,month,day);}void rili5(){int year,month,date,sec,mini,hour;fan();show(year,month,date,sec,mini,hour);}int leap(int year){int n=(year%4==0 && year%100!=0 || year%100!=0); return n;}void rili(int year,int month){int i,day,first_day,flag,year1,year2;int temp = 6;flag =leap(year);year1=year/100;year2=year%100;if(year>2000){year1=year1-20;day = year1/4;day+=(YEAR+24)*year1+YEAR*year2+(year2-1)/4;if(year>2000)day++;switch(month){case 1:day; break;case 2:day+=31;break;case 3:day+=59+flag;break;case 4:day+=90+flag;break;case 5:day+=120+flag;break;case 6:day+=151+flag;break;case 7:day+=181+flag;break;case 8:day+=212+flag;break;case 9:day+=243+flag;break;case 10:day+=273+flag;break;case 11:day+=304+flag;break;case 12:day+=334+flag;break;}day+=temp;first_day=day%7;}else{year1 = 20-1-year;year2=100-year2-1;day+=(YEAR+24)*year1+YEAR*year2+year2/4; switch(month){case 12:day+=31;break;case 11:day+=61;break;case 10:day+=92;break;case 9:day+=122;break;case 8:day+=153;break;case 7:day+=184;break; case 6:day+=214;break; case 5:day+=245;break; case 4:day+=275;break; case 3:day+=306;break; case 2:day+=334+flag;break; case 1:day+=365+flag;break; }day-=temp;day = day%7;first_day=(7-day)%7;}switch(month){case 1:case 2:month=28+flag;break; case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:month=30;break; case 12:month =31;break;}for(i=1;i<4*first_day;i++) printf(" ");for(i=0;i<month;i++)< p="">{printf("%4d",i+1);if((first_day+i)%7==6)printf("\n");}printf("\n");printf("===============================\n");}///////////////////////////////////////////////////////////int counterdays(int year,int month,int day){int year1,days0,days1,month1,days,day1;time_t timep;struct tm*p;time(&timep);p=gmtime(&timep);year1=(1900+p->tm_year);month1=(1+p->tm_mon);day1=(p->tm_mday);days0=(year-1)*365 + (year-1)/4 - (year-1)/100 + (year-1)/400 +eachyeartotal (year,month,day);days1=(year1 - 1)*365+(year1-1)/4-(year1-1)/100 + (year1 - 1)/400 +eachyeartotal (year1,month1,day1);days=days0-days1;printf("\n今天距%d年%d月%d日还有%d天\n\n",year,month,day,days);return days;}int eachyeartotal(int year,int month,int day){int i,sum=0;for(i=1;i<month;i++)< p="">{sum+=maxDay(year,i);}sum+=day;return sum;}int IsLeap(int y){if(y%4==0 && y%100!=0 || y%400==0) return 1; else return 0;}int maxDay(int y,int month){int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};if(IsLeap(y))a[1]=29;return a[month-1];}///////////////////////////////////////void festival (int year,int month,int day){if (month==1 && day==1) printf (",这天是元旦");if (month==2 && day==14) printf (",这天是情人节"); if (month == 3)switch(day){case 8:printf (",这天是妇女节"); break;case 12:printf (",这天是植树节");}if (month==1 && day==1) printf (",这天是愚人节");if(month == 5)switch (day){case 1:printf(",这天是劳动节");break;case 4:printf(",这天是青年节");}if (month==6 && day==1) printf (",这天是儿童节");if (month==7 && day==1) printf (",这天是建党节");if (month==8 && day==1) printf (",这天是建军节");if (month==9 && day==10) printf (",这天是教师节");if (month==10 && day==1) printf (",这天是国庆节");printf("\n");}int week(int year,int month,int day){int number = (year-1)+(year-1)/4 - (year-1)/100+(year-1)/400+eachyeartotal(year,month,day);number = number%7;return number;}/////////////////////////////////////////////void print(int y,int m,int w){int i,l;printf("Calendar %d-%02d\n",y,m);printf("---------------------\n");printf("Su Mo Tu We Th Fr Sa \n");printf("---------------------\n");for (i=0;i<w;i++)< p=""> printf(" ");if (IsLeap(y))l=1;elsel=0;for (i=1;i<=numday[l][m-1];i++) {printf("%-3d",i);w++;if (w%7==0)printf("\n");}if (w%7) printf("\n");printf("---------------------\n"); }int calday(int y,int m){int d=0,w;while (y>1910){if (IsLeap(y)) d+=366;else d+=365;y--;}while (m>1){ --m;d+=numday[0][m-1];}w=(d+1)%7;return w;}//////////////////////////////////////////void show(int year,int month,int date,int sec,int mini,int hour) {const char month_str[][4]={"","Jan","Feb","Mar","Apl", "May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};const int month_day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};int i,j,wdays,mdays,days;for(i=1,days=0;i<year;i++)< p="">{if(leap(i))days += 366;}else{days += 365;}}for(i=1;i<month;i++)< p="">{if(i==2 && leap(year)){days+=29;}else{days+=month_day[i];}}printf(" %s.%d.%d %d:%d:%d \n",month_str[month],date,year,hour,mini,sec);printf(" 一二三四五六日\n");wdays = days % 7;for( j = 0; j < wdays; j++){printf(" ");}if(month == 2 && leap(year)){mdays=29;}else{mdays= month_day[month];}for(i=1;i<=mdays;i++){if( i > 1 && days % 7 == 0 ){printf("\n");}printf("%4d",i);days=days+1; }printf("\n---------------------------\n\n\n");}{time_t rawtime;struct tm *info;int year,month,date,sec,mini,hour; char ch;time ( &rawtime );info = localtime ( &rawtime );year =info->tm_year + 1900; month =info->tm_mon + 1;date =info->tm_mday;hour =info->tm_hour;mini =info->tm_min;sec =info->tm_sec;while(1){show(year,month,date,sec,mini,hour); printf("↑......上一年\n\n");printf("↓......下一年\n\n");printf("←....前一个月\n\n");pr intf("→....后一个月\n\n");printf("Esc.......退出\n\n");ch=getch();switch(ch){case 27://Ecs exit(0);case -32://Navigatorch=getch();if(ch==77){//Rightyear+=(month==12)?1:0;month=month%12+1;}else if(ch==75){year-=(month==1)?1:0; month=(month-2+12)%12+1; }else if(ch==72)year--;else if(ch==80)year++;system("cls");}}</month;i++)<></year;i++)<></w;i++)<></month;i++)<></month;i++)<>。
打印日历每行三个月份源代码

case 5:days = 120 + day;break;
case 6:days = 151 + day;break;
case 7:days = 181 + day;break;
case 8:days = 212 + day;break;
case 9:days = 243 + day;break;
break;
case 4:
mfOfWeek = zhouji(year,10, 1);
mfDays = 31;
msOfWeek = zhouji(year, 11, 1);
msDays = 30;
mtOfWeek = zhouji(year, 12, 1);
mtDays = 31;
PrintOneQuarter(year, mfOfWeek, mfDays, msOfWeek, msDays, mtOfWeek, mtDays, hang);
{
if (month > 2)
{
++days;
}
}
return days;
}
void PrintOneQuarter(int year, int mfOfWeek, int mfDays, int msOfWeek,
int msDays, int mtOfWeek, int mtDays, int hang)
int msOfWeek, int msDays, int mtOfWeek, int mtDays, int hang);
int zhouji(int year, int month, int day);
日历源代码——java

日历源代码——java//import java.sql.Date;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import java.util.Locale;public class GregorianCalendar日历 {public static void main(String[] args) { //设置不同地区Locale.setDefault();//创建当前日历对象GregorianCalendar now = new GregorianCalendar();//从当前时期对象是取出时间日期对象//编辑错误:Type mismatch: cannot convert from java.util.Date to java.sql.DateDate date = now.getTime();//将时间日期对象按字符形式打印System.out.println(date.toString());//重新将时间对象设置到日期对象中now.setTime(date);//从当前日期对象是取出当前月份、日期int today =now.get(Calendar.DAY_OF_MONTH);int month = now.get(Calendar.MONTH);//获取本月开始日期now.set(Calendar.DAY_OF_MONTH, 1);//获取本月开始日期在一周中的编号int week = now.get(Calendar.DAY_OF_WEEK);//打印日历头并换行设置当前月中第一天的开始位置System.out.println("星期日星期一星期二星期三星期四星期五星期六");//设置当前月中第一天的开始位置for( int i = Calendar.SUNDAY; i < week; i++){ System.out.print(" ");//按规格打印当前月的日期数字while(now.get(Calendar.MONTH) ==month){//取出当前日期int day =now.get(Calendar.DAY_OF_MONTH);//设置日期数字小于10与不小于10两种情况的打印规格if(day < 10){//设置当前日期的表现形式if(day == today)System.out.print(" <" + day + "> ");elseSystem.out.print(" " + day + " ");}else{//设置当前日期的表现形式if(day == today)System.out.print(" <" + day + "> ");elseSystem.out.print(" " + day + " ");}//设置什么时候换行if(week == Calendar.SATURDAY)System.out.println();//设置日期与星期几为下一天now.add(Calendar.DAY_OF_MONTH, 1);week = now.get(Calendar.DAY_OF_WEEK);}}}}。
前端开发实训案例教程初级开发简单的在线日历应用

前端开发实训案例教程初级开发简单的在线日历应用前端开发实训案例教程:初级开发简单的在线日历应用在本篇教程中,我们将学习如何利用前端开发技术创建一个简单的在线日历应用。
在线日历应用是一种常见的实际应用程序,它可以帮助用户记录和组织重要的日期和事件。
我们将使用HTML、CSS和JavaScript来实现这个日历应用。
1. 搭建基本框架我们首先创建一个基本的HTML文件。
在文件中,我们添加一个标题,一个容器用于显示日历,并引入所需的CSS和JavaScript文件。
```html<!DOCTYPE html><html><head><title>简单的在线日历应用</title><link rel="stylesheet" type="text/css" href="style.css"></head><body><h1>简单的在线日历应用</h1><div id="calendar"></div><script src="script.js"></script></body></html>```2. CSS样式接下来,我们需要为日历应用添加CSS样式。
创建一个名为`style.css`的CSS文件,并添加以下代码:```css#calendar {width: 300px;border: 1px solid #ccc;padding: 10px;}#calendar table {width: 100%;}#calendar th {background-color: #ccc;}#calendar td {text-align: center;padding: 5px;}#calendar .today {background-color: #f00;color: #fff;}#calendar .selected {background-color: #0f0;}```3. 实现日历功能现在我们开始使用JavaScript编写日历应用的逻辑。
日历代码_精品文档

日历代码
1. 简介
日历是用来显示日期的一种工具。
在计算机编程中,我们可以通过编写代码来生成和显示日历。
本文将介绍如何用Python编写一个简单的日历代码。
我们将使用Python的datetime和calendar模块来实现这个功能。
2. 实现步骤
2.1 导入模块
我们首先需要导入Python的datetime和calendar模块。
datetime模块提供了日期和时间的相关功能,而calendar模块则提供了生成日历的功能。
import datetime
import calendar
2.2 获取当前日期
我们可以使用datetime模块的date类来获取当前日期。
today = datetime.date.today()
2.3 获取当前月份的日历
我们可以使用calendar模块的monthcalendar函数来生成当前月份的日历。
cal = calendar.monthcalendar(today.year, today.month)
2.4 打印日历
我们可以使用循环遍历生成的日历列表,并打印出每个日期。
```python for week in cal: for day in week: if day == 0: print(。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
运行界面:// CalendarWindow类package others;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.util.*;import java.io.*;import java.awt.SplashScreen;public class CalendarWindow extends JFrame implements ActionListener,MouseListener,FocusListener {Calendar calendar;int year,month,day;CalendarMessage calendarMessage;CalendarPad calendarPad;NotePad notePad;JTextField showYear,showMonth;JTextField showDay[];CalendarImage calendarImage;String picturename;//图像名称;String getPicture_address;Alarm alarm;JButton nextYear,previousYear,nextMonth,previousMonth;JButton saveDailyRecord,deleteDailyRecord,readDailyRecord,changeBackground;File dir;Color backColor=Color.white;public CalendarWindow(){dir= new File("./dailyRecord");dir.mkdir();showDay = new JTextField[42];for(int i=0;i<showDay.length;i++){showDay[i]=new JTextField();showDay[i].setBackground(backColor);showDay[i].setLayout(new GridLayout(3,3));}calendarMessage = new CalendarMessage();calendarPad = new CalendarPad();notePad = new NotePad();Calendar calendar = Calendar.getInstance();calendar.setTime(new Date());year = calendar.get(Calendar.YEAR);month = calendar.get(Calendar.MONTH)+1;day = calendar.get(Calendar.DAY_OF_MONTH);calendarMessage.setYear(year);calendarMessage.setMonth(month);calendarMessage.setDay(day);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);notePad.setMessage(year,month,day);calendarPad.showMonthCalendar();doMark();calendarImage = new CalendarImage();picturename=getPicture_address();//calendarImage.setImageFile(new File(picturename));alarm=new Alarm();JSplitPane splitV1 = newJSplitPane(JSplitPane.VERTICAL_SPLIT,calendarPad,calendarImage);JSplitPane splitV2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT,notePad,alarm); JSplitPane splitH = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,splitV1,splitV2); add(splitH,BorderLayout.CENTER);showYear = new JTextField(""+year,6);showYear.setFont(new Font("TimesRoman",Font.BOLD,12));showYear.setHorizontalAlignment(JTextField.CENTER);showMonth = new JTextField(""+month,4);showMonth.setFont(new Font("TimesRoman",Font.BOLD,12));showMonth.setHorizontalAlignment(JTextField.CENTER);nextYear = new JButton("下年");previousYear = new JButton("上年");nextMonth = new JButton("下月");previousMonth = new JButton("上月");nextYear.addActionListener(this);previousYear.addActionListener(this);nextMonth.addActionListener(this);previousMonth.addActionListener(this);showYear.addActionListener(this);showMonth.addActionListener(this);JPanel north = new JPanel();north.add(previousYear);north.add(showYear);north.add(nextYear);north.add(previousMonth);north.add(showMonth);north.add(nextMonth);add(north,BorderLayout.NORTH);changeBackground = new JButton("更改背景图片");saveDailyRecord = new JButton("保存日志");deleteDailyRecord = new JButton("删除日志");readDailyRecord = new JButton("读取日志");changeBackground.addActionListener(this);saveDailyRecord.addActionListener(this);JPanel pSouth = new JPanel();pSouth.add(changeBackground);pSouth.add(saveDailyRecord);pSouth.add(deleteDailyRecord);pSouth.add(readDailyRecord);add(pSouth,BorderLayout.SOUTH);setVisible(true);setBounds(70,70,770,500);validate();setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public String getPicture_address(){String address=null;try{FileInputStream outOne=new FileInputStream("picture_address.txt");ObjectInputStream outTwo=new ObjectInputStream(outOne);try{address=(String)outTwo.readObject();}catch(Exception ex){}outTwo.close();}catch(IOException eee){}if(address!=null){return address;}else{return"picture.jpg";}}public void actionPerformed(ActionEvent e){if(e.getSource()==changeBackground){FileDialog dia=new FileDialog(this,"选定图片",FileDialog.LOAD);//新建一个文件选择对话框,用dia获得选择得到的信息;dia.setModal(true);//设置为模态对话框;dia.setVisible(true);if((dia.getDirectory()!=null)&&(dia.getFile()!=null))//如果得到的路径和文件名不为空;{try{FileOutputStream inOne=new FileOutputStream("picture_address.txt");ObjectOutputStream inTwo=new ObjectOutputStream(inOne);inTwo.writeObject(dia.getDirectory()+dia.getFile());inTwo.close();}catch(IOException ee){}picturename=getPicture_address();//从文件中读出显示图片的路径地址;calendarImage.setImageFile(new File(picturename));//将获得路径传给图片,显示该路径指定}}if(e.getSource()==nextYear){year++;showYear.setText(""+year);calendarMessage.setYear(year);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);calendarPad.showMonthCalendar();notePad.setMessage(year,month,day);doMark();}else if (e.getSource()==previousYear){year--;showYear.setText(""+year);calendarMessage.setYear(year);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);calendarPad.showMonthCalendar();notePad.setMessage(year,month,day);doMark();}else if (e.getSource()==nextMonth){month++;if(month>12){month=1;year++;}showYear.setText(""+year);showMonth.setText(""+month);calendarMessage.setMonth(month);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);calendarPad.showMonthCalendar();notePad.setMessage(year,month,day);doMark();}else if (e.getSource()==previousMonth){month--;if(month<1){month=12;year--;}showYear.setText(""+year);showMonth.setText(""+month);calendarMessage.setMonth(month);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);calendarPad.showMonthCalendar();notePad.setMessage(year,month,day);doMark();else if (e.getSource()==showYear){String s = showYear.getText().trim();char a[] = s.toCharArray();boolean boo = false;for(int i = 0;i < a.length;i++){if(!(Character.isDigit(a[i])))boo = true;}if(boo==true)JOptionPane.showMessageDialog(this,"你输入了非法年份","警告!",JOptionPane.WARNING_MESSAGE);else if(boo==false)year = Integer.parseInt(s);showYear.setText(""+year);calendarMessage.setYear(year);calendarPad.setCalendarMessage(calendarMessage);calendarPad.showMonthCalendar();notePad.setMessage(year,month,day);doMark();}else if(e.getSource()==showMonth){String s = showMonth.getText().trim();char a[] = s.toCharArray();boolean boo = false;for(int i = 0;i < a.length;i++){if(!(Character.isDigit(a[i])))boo = true;}if(boo==true)JOptionPane.showMessageDialog(this,"你输入了非法月份","警告!",JOptionPane.WARNING_MESSAGE);else if(boo==false)month = Integer.parseInt(s);showMonth.setText(""+month);calendarMessage.setYear(month);calendarPad.setCalendarMessage(calendarMessage);calendarPad.showMonthCalendar();notePad.setMessage(year,month,day);doMark();}else if (e.getSource()== saveDailyRecord){notePad.savefile(dir,year,month,day);doMark();}else if(e.getSource()==deleteDailyRecord){notePad.deletefile(dir,year,month,day);doMark();}else if (e.getSource()==readDailyRecord){doMark();}}public void mousePressed(MouseEvent e){JTextField text = (JTextField)e.getSource();String str = text.getText().trim();try{day = Integer.parseInt(str);}catch (NumberFormatException exp){}calendarMessage.setDay(day);notePad.setMessage(year,month,day);}public void mouseReleased(MouseEvent e){}public void mouseEntered(MouseEvent e){}public void mouseExited(MouseEvent e){}public void mouseClicked(MouseEvent e){}public void focusGained(FocusEvent e){Component com = (Component)e.getSource();com.setBackground(Color.blue);}public void focusLost(FocusEvent e){Component com = (Component)e.getSource();com.setBackground(backColor);}public void doMark(){for(int i=0;i<showDay.length;i++){showDay[i].removeAll();String str = showDay[i].getText().trim();try{int n = Integer.parseInt(str);if(isHaveDailyRecord(n)==true){JLabel mess = new JLabel("yes");mess.setFont(new Font("TimesRoman",Font.PLAIN,11));mess.setForeground(Color.red);showDay[i].add(mess);showDay[i].setBackground(Color.pink);}if(n==calendar.get(Calendar.DAY_OF_MONTH)){showDay[i].setFont(new Font("微软雅黑",Font.ITALIC,23));//showDay[i].setBackground(Color.DARK_GRAY);showDay[i].setForeground(Color.red);}}catch (Exception exp){}calendarPad.repaint();calendarPad.validate();}public boolean isHaveDailyRecord(int n){String key = ""+year+""+month+""+n;String []dayFile = dir.list();boolean boo = false;for(int k = 0;k<dayFile.length;k++){if(dayFile[k].equals(key+".txt")){boo = true;break;}}return boo;}public static void main(String args[]){new CalendarWindow();}}//calendarPad类package others;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.util.*;public class CalendarPad extends JPanel{int year,month,day;CalendarMessage calendarMessage;JTextField []showDay;JLabel title [];String [] week={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};JPanel north,center;public CalendarPad(){setLayout(new BorderLayout());north=new JPanel();north.setLayout(new GridLayout(1,7));center=new JPanel();center.setLayout(new GridLayout(6,7));add(center,BorderLayout.CENTER);add(north,BorderLayout.NORTH);title=new JLabel[7];for(int j=0;j<7;j++){title[j]=new JLabel();title[j].setFont(new Font("TimesRoman",Font.BOLD,12));title[j].setText(week[j]);title[j].setHorizontalAlignment(JLabel.CENTER);title[j].setBorder(BorderFactory.createRaisedBevelBorder());north.add(title[j]);}title[0].setForeground(Color.red);title[6].setForeground(Color.blue);}showDay=text;for(int i=0;i<showDay.length;i++){showDay[i].setFont(new Font("TimesRoman",Font.BOLD,15));showDay[i].setBackground(Color.WHITE);showDay[i].setHorizontalAlignment(JTextField.CENTER);showDay[i].setEditable(false);center.add(showDay[i]);}}public void setCalendarMessage(CalendarMessage calendarMessage){this.calendarMessage=calendarMessage;}public void showMonthCalendar(){String [] a=calendarMessage.getMonthCalendar();for(int i=0;i<42;i++){showDay[i].setText(a[i]);}validate();}}//NotePad类package others;import java.awt.*;import javax.swing.*;import java.io.*;import java.awt.event.*;class NotePad extends JPanel implements ActionListener,ItemListener {JTextField ShowMessage;JTextArea text;JLabel l1;JPanel p1,p2,p3;Choice fontlist,sizelist;JButton changecolor;String Size[]={"10","12","14","16","18","20","22","24","26","28","30"};NotePad(){ShowMessage=new JTextField();ShowMessage.setEditable(false);text=new JTextArea(10,20);p1=new JPanel();p2=new JPanel();p3=new JPanel();l1=new JLabel("记事本字体");changecolor=new JButton("颜色");fontlist=new Choice();sizelist=new Choice();GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();String fontname[]=ge.getAvailableFontFamilyNames();for(int i=0;i<fontname.length;i++){fontlist.add(fontname[i]);}for(int i=0;i<Size.length;i++){}p1.add(l1);p1.add(fontlist);p1.add(sizelist);p1.add(changecolor);setLayout(new BorderLayout());add(ShowMessage,BorderLayout.NORTH);p2.setLayout(new BorderLayout());p2.add(new JScrollPane(text),BorderLayout.CENTER);p2.add(p3,BorderLayout.SOUTH);add(p2,BorderLayout.CENTER);add(p1,BorderLayout.SOUTH);setBounds(0,0,400,400);setVisible(true);changecolor.addActionListener(this);fontlist.addItemListener(this);sizelist.addItemListener(this);}public void setMessage(int year,int month,int day){ShowMessage.setText(year+"年"+month+"月"+day+"日");ShowMessage.setHorizontalAlignment(JLabel.CENTER);ShowMessage.setForeground(Color.blue);ShowMessage.setFont(new Font("宋体",Font.BOLD,15));text.setText("");}public void actionPerformed(ActionEvent e){if(e.getSource()==changecolor){Color newColor=JColorChooser.showDialog(this, "选择颜色", text.getForeground());if(newColor!=null){text.setForeground(newColor);}}}public void itemStateChanged(ItemEvent e){String n1=sizelist.getSelectedItem();String name=fontlist.getSelectedItem();int n2=Integer.parseInt(n1);Font f=new Font(name,Font.PLAIN,n2);text.setFont(f);}public void savefile(File dir,int year,int month,int day){String dailyRecord=text.getText();String fileName=""+year+""+month+""+day+".txt";String key=""+year+""+month+""+day;String dialyFile[]=dir.list();boolean b=false;for(int i=0;i<dialyFile.length;i++){if(dialyFile[i].startsWith(key)){}}if(b){int n=JOptionPane.showConfirmDialog(this,""+year+"年"+month+"月"+day+"日"+"已经有日志存在,是否添加日志?","确认对话框",JOptionPane.YES_NO_OPTION);if(n==JOptionPane.YES_OPTION){try{File file=new File(dir,fileName);RandomAccessFile out=new RandomAccessFile(file,"rw");long end=out.length();byte[]bb=dailyRecord.getBytes();out.seek(end);out.write(bb);out.close();}catch(IOException e){}text.setText("");}else{text.setText("");}}else{int n=JOptionPane.showConfirmDialog(this,"是否添加"+year+"年"+month+"月"+day+"日"+"日志?","确认对话框",JOptionPane.YES_NO_OPTION);if(n==JOptionPane.YES_OPTION){try{File file=new File(dir,fileName);FileWriter fw=new FileWriter(file);BufferedWriter bw=new BufferedWriter(fw);bw.write(dailyRecord);bw.close();fw.close();}catch(IOException e){}JOptionPane.showMessageDialog(this,"添加日志成功","消息对话框",RMATION_MESSAGE);text.setText("");}}}public void deletefile(File dir,int year,int month,int day){String key=""+year+""+month+""+day;String dialyFile[]=dir.list();boolean b=false;for(int i=0;i<dialyFile.length;i++){if(dialyFile[i].startsWith(key)){break;}}if(b){int n=JOptionPane.showConfirmDialog(this,"是否删除"+year+"年"+month+"月"+day+"日的日志?","确认对话框",JOptionPane.YES_NO_OPTION);if(n==JOptionPane.YES_OPTION){try{String fileName=""+year+""+month+""+day+".txt";File file=new File(dir,fileName);file.delete();}catch(Exception e){}text.setText("");}}else{JOptionPane.showMessageDialog(this,""+year+"年"+month+"月"+day+"日无日志!","消息对话框",RMATION_MESSAGE);}}public void readfile(File dir,int year,int month,int day){String fileName=""+year+""+month+""+day+".txt";String key=""+year+""+month+""+day;String dialyFile[]=dir.list();boolean b=false;for(int i=0;i<dialyFile.length;i++){if(dialyFile[i].startsWith(key)){b=true;break;}}if(b){text.setText("");try{File file=new File(dir,fileName);FileReader inOne=new FileReader(file);BufferedReader inTwo=new BufferedReader(inOne);String s;while((s=inTwo.readLine())!=null){text.append(s+"\n");}inOne.close();inTwo.close();}catch(IOException e){}}else{JOptionPane.showMessageDialog(this,""+year+"年"+month+"月"+day+"日无日志!","消息对话框",RMATION_MESSAGE);}}}//CalendarMessage类package others;import java.util.Calendar;public class CalendarMessage{int year=-1,month=-1,day=-1;public void setYear(int year){this.year=year;}public int getYear(){return year;}public void setMonth(int month){if(month<=12&&month>=1)this.month=month;elsethis.month=1;}public int getMonth(){return month;}public void setDay(int day){this.day=day;}public int getday(){return day;}public String [] getMonthCalendar(){String [] day=new String[42];Calendar rili=Calendar.getInstance();rili.set(year,month-1,1);//将日历翻到year年month月1日int星期几=rili.get(Calendar.DAY_OF_WEEK)-1;int dayAmount=0;if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) dayAmount=31;if(month==4||month==6||month==9||month==11)dayAmount=30;if(month==2){if(((year%4==0)&&(year%100!=0))||year%400==0)dayAmount=29;elsedayAmount=28;}for(int i=0;i<星期几;i++)day[i]="";for(int i=星期几,n=1;i<星期几+dayAmount;i++){day[i]=String.valueOf(n);n++;}for (int i=星期几+dayAmount;i<42;i++ )day[i]="";return day;}}// CalendarImage类package others;import javax.swing.*;import java.io.*;import java.awt.*;public class CalendarImage extends JPanel{File imageFile;Image image;Toolkit tool;//构造方法public CalendarImage() {tool=getToolkit();//获取工具;}//设置图像文件;public void setImageFile(File f){imageFile =f;try{image=tool.getImage(imageFile.toURI().toURL());//得到图像文件;}catch (Exception eeee){}repaint();//重绘;}//重载paintComponent方法,覆盖原来的,供repaint()调用;public void paintComponent(Graphics g){super.paintComponent(g);int w=getBounds().width;int h=getBounds().height;g.drawImage(image,0,0,w,h,this);}}//Alarm类package others;import java.applet.Applet;import java.applet.AudioClip;import java.awt.Color;import java.awt.Container;import java.awt.Font;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.File;import .MalformedURLException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.Locale;import javax.swing.*;public class Alarm extends JPanel implements Runnable {JLabel ri ,shi, fen, miao, dangqian;JButton queding, dakai;JTextField music,day, hour, minute, second;int h=0,f=0,m=0,r=0;boolean fo=false;public AudioClip soumd1;public Alarm() {setLayout(new GridLayout(3, 1));JPanel jp = new JPanel();dangqian = new JLabel();jp.add(dangqian);add(jp);JPanel jp1 = new JPanel();music = new JTextField(20);dakai = new JButton("选择闹铃音乐");jp1.add(music);jp1.add(dakai);add(jp1);ri = new JLabel("日");day = new JTextField(4);shi = new JLabel("时");hour = new JTextField(4);fen = new JLabel("分");minute = new JTextField(4);miao = new JLabel("秒");second = new JTextField(4);JPanel jp2 = new JPanel();jp2.add(ri);jp2.add(day);jp2.add(shi);jp2.add(hour);jp2.add(fen);jp2.add(minute);jp2.add(miao);jp2.add(second);queding = new JButton("确定");jp2.add(queding);add(jp2);setSize(400, 130);setVisible(true);dakai.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent event) {JFileChooser fileChooser = new JFileChooser(); // 实例化文件选择器fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); // 设置文件选择模式,此处为文件和目录均可fileChooser.setCurrentDirectory(new File(".")); // 设置文件选择器当前目录fileChooser.setFileFilter(new javax.swing.filechooser.FileFilter() {public boolean accept(File file) { // 可接受的文件类型String name = file.getName().toLowerCase();return name.endsWith(".wav")|| name.endsWith(".au")|| file.isDirectory();}public String getDescription() { // 文件描述return "音乐文件(*.wav,*.au)";}});if (fileChooser.showOpenDialog(Alarm.this) == JFileChooser.APPROVE_OPTION) { // 弹出文件选择器,并判断是否点击了打开按钮String fileName = fileChooser.getSelectedFile().getAbsolutePath(); // 得到选择文件或目录的绝对路径music.setText(fileName);}}});queding.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent event) {if(queding.getText().equals("确定")){try{r=Integer.parseInt(day.getText());h=Integer.parseInt(hour.getText());f=Integer.parseInt(minute.getText());m=Integer.parseInt(second.getText());if(1<=h&&h<=31&&0<=h&&h<=23&&0<=f&&f<=59&&0<=m&&m<=59){fo=true;}elseJOptionPane.showMessageDialog(null, "输入时间错误");}catch(Exception e){JOptionPane.showMessageDialog(null, "请输入正确的时间");}}else{fo=false;day.setEditable(true);hour.setEditable(true);minute.setEditable(true);second.setEditable(true);queding.setText("确定");//soumd1.stop();}}});Thread t1 = new Thread(this);t1.start();}public void run() {while (true) {Date now = new Date();SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒",Locale.SIMPLIFIED_CHINESE);dangqian.setFont(new Font("微软雅黑",Font.BOLD,20));dangqian.setForeground(Color.RED);dangqian.setText("当前时间: " + sdf.format(now));SimpleDateFormat ri=new SimpleDateFormat("dd"); //封装为了获取日期SimpleDateFormat shi=new SimpleDateFormat("kk"); //封装为了获取小时SimpleDateFormat fen=new SimpleDateFormat("mm"); //封装为了获取分钟SimpleDateFormat miao=new SimpleDateFormat("ss"); //封装为了获取秒钟int riqi=Integer.parseInt(ri.format(now)); //获取日期int shizhong=Integer.parseInt(shi.format(now)); //获取小时int fenzhong=Integer.parseInt(fen.format(now)); //获取分钟int miaozhong=Integer.parseInt(miao.format(now)); //获取秒钟if(fenzhong==0&&miaozhong==0)try {soumd1=Applet.newAudioClip(new File(music.getText()).toURL()); //播放音乐soumd1.play();fo=false;} catch (MalformedURLException e) {e.printStackTrace();}if(fo){day.setEditable(false);hour.setEditable(false);minute.setEditable(false);second.setEditable(false);queding.setText("关闭");if(riqi==r&&shizhong==h&&fenzhong==f&&miaozhong==m) //判断条件{try {soumd1=Applet.newAudioClip(new File(music.getText()).toURL()); //播放音乐soumd1.play();fo=false;} catch (MalformedURLException e) {e.printStackTrace();}}}try {Thread.sleep(1000);} catch (InterruptedException ie) {}}}}。