欢迎来到天天文库
浏览记录
ID:40272478
大小:237.01 KB
页数:23页
时间:2019-07-30
《Java日历记事本课程设计报告》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Java日历记事本课程设计报告在设计日历记事本时,需要编写6个JAVA源文件:CalendarWindow.java、CalendarPad.java、NotePad.java、CalendarImage.java、Clock.java和CalendarMesssage.java效果图如下.CalendarWindow类importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.util.*;importjava.io.
2、*;publicclassCalendarWindowextendsJFrameimplementsActionListener,MouseListener,FocusListener{intyear,month,day;CalendarMessagecalendarMessage;CalendarPadcalendarPad;NotePadnotePad;JTextFieldshowYear,showMonth;JTextField[]showDay;CalendarImagecalendarIma
3、ge;Stringpicturename;Clockclock;JButtonnextYear,previousYear,nextMonth,previousMonth;JButtonsaveDailyRecord,deleteDailyRecord,readDailyRecord;JButtongetPicture;Filedir;ColorbackColor=Color.white;publicCalendarWindow(){dir=newFile("./dailyRecord");dir.mk
4、dir();showDay=newJTextField[42];for(inti=0;i5、=newCalendarMessage();calendarPad=newCalendarPad();notePad=newNotePad();Calendarcalendar=Calendar.getInstance();calendar.setTime(newDate());year=calendar.get(Calendar.YEAR);month=calendar.get(Calendar.MONTH)+1;day=calendar.get(Calendar.DAY_OF_MONTH);cal6、endarMessage.setYear(year);calendarMessage.setMonth(month);calendarMessage.setDay(day);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);notePad.setShowMessage(year,month,day);calendarPad.showMonthCalendar();doMark7、();calendarImage=newCalendarImage();calendarImage.setImageFile(newFile("flower.jpg"));clock=newClock();JSplitPanesplitV1=newJSplitPane(JSplitPane.VERTICAL_SPLIT,calendarPad,calendarImage);JSplitPanesplitV2=newJSplitPane(JSplitPane.VERTICAL_SPLIT,notePad8、,clock);JSplitPanesplitH=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,splitV1,splitV2);add(splitH,BorderLayout.CENTER);showYear=newJTextField(""+year,6);showYear.setFont(newFont("TimesRoman",Font.BOLD,12));showYear.setHorizontalAlig
5、=newCalendarMessage();calendarPad=newCalendarPad();notePad=newNotePad();Calendarcalendar=Calendar.getInstance();calendar.setTime(newDate());year=calendar.get(Calendar.YEAR);month=calendar.get(Calendar.MONTH)+1;day=calendar.get(Calendar.DAY_OF_MONTH);cal
6、endarMessage.setYear(year);calendarMessage.setMonth(month);calendarMessage.setDay(day);calendarPad.setCalendarMessage(calendarMessage);calendarPad.setShowDayTextField(showDay);notePad.setShowMessage(year,month,day);calendarPad.showMonthCalendar();doMark
7、();calendarImage=newCalendarImage();calendarImage.setImageFile(newFile("flower.jpg"));clock=newClock();JSplitPanesplitV1=newJSplitPane(JSplitPane.VERTICAL_SPLIT,calendarPad,calendarImage);JSplitPanesplitV2=newJSplitPane(JSplitPane.VERTICAL_SPLIT,notePad
8、,clock);JSplitPanesplitH=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,splitV1,splitV2);add(splitH,BorderLayout.CENTER);showYear=newJTextField(""+year,6);showYear.setFont(newFont("TimesRoman",Font.BOLD,12));showYear.setHorizontalAlig
此文档下载收益归作者所有