用Java实现日历记事本 联系客服

发布时间 : 星期一 文章用Java实现日历记事本更新完毕开始阅读

file=new File(\日历记事本.txt\ if(!file.exists()){ try{ FileOutputStream out=new FileOutputStream(file); ObjectOutputStream objectOut=new ObjectOutputStream(out); objectOut.writeObject(hashtable); objectOut.close(); out.close(); } catch(IOException e){} } setCalendar(year,month); addWindowListener(new WindowAdapter() { //设置窗口监视器 public void windowClosing(WindowEvent e) { System.exit(0); } } ); setVisible(true); setBounds(100,60,524,335); validate(); } public void actionPerformed(ActionEvent e) { if(e.getSource()==Save) { notepad.Save(file,year,month,day); } else if(e.getSource()==Delete) { notepad.Delete(file,year,month,day); } else if(e.getSource()==Read) { notepad.Read(file,year,month,day); } } public void setCalendar(int year,int month) { //设置日历卡 Date.set(year,month-1,1); Weekday=Date.get(Calendar.DAY_OF_WEEK)-1; if(month==1||month==2||month==3||month==5||month==7 ||month==8||month==10||month==12) { Arrange(Weekday,31); } else if(month==4||month==6||month==9||month==11) { Arrange(Weekday,30); } else if(month==2) { if((year%4==0&&year0!=0)||(year@0==0)) { Arrange(Weekday,29); } else { Arrange(Weekday,28); } } } public void Arrange(int Weekday,int Monthday) { //把日期,按星期排列 for(int i=Weekday,n=1;i