}
month_log=month_log+1; //将传来的月份数加1 switch(month_log){ case 1: case 3: case 5: case 7: case 8: case 10: case 12:
month_day_score=31; break; case 4: case 6: case 9: case 11:
month_day_score=30; break; case 2:
if(month_score_log==1){ month_day_score=29; } else{
month_day_score=28;
}
break; }
for(int i=7;i<49;i++){ //初始化标签 label.setText(\}
week_log=week_log+6; //将星期数加6,使显示正确 month_day_score=month_day_score+week_log;
for(int i=week_log;i //创建时钟 class Clock extends Canvas implements Runnable{ MainFrame mf; Thread t; String time; Clock(MainFrame mf){ this.mf=mf; setSize(400,40); setBackground(Color.white); t=new Thread(this); //实例化线程 t.start(); //调用线程 } public void run(){ while(true){ try{ t.sleep(1000); //休眠1秒钟 }catch(InterruptedException e){ System.out.println(\异常\} this.repaint(100); } } public void paint(Graphics g){ Font f=new Font(\宋体\ SimpleDateFormat SDF=new SimpleDateFormat(\年'MM'月'dd'日'HH:mm:ss\格式化时间显示类型 Calendar now=Calendar.getInstance(); time=SDF.format(now.getTime()); //得到当前日期和时间 g.setFont(f); g.setColor(Color.red); g.drawString(time,100,25); } } public class Wnl{ public static void main(String [] args){ JFrame.setDefaultLookAndFeelDecorated(true); MainFrame start=new MainFrame(); } }