Java日历记事本课程设计报告
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Java 日历记事本课程设计报告
在设计日历记事本时,需要编写6个JAVA源文件:、、、、和
效果图如下
. CalendarWindow 类
import .*;
import .*;
import .*;
import .*;
public class CalendarWindow extends JFrame
implements ActionListener,MouseListener,FocusListener{
int year,month,day;
CalendarMessage calendarMessage;
CalendarPad calendarPad;
NotePad notePad;
JTextField showYear,showMonth;
JTextField[] showDay;
CalendarImage calendarImage;
String picturename;
Clock clock;
JButton nextYear,previousYear,nextMonth,previousMonth;
JButton saveDailyRecord,deleteDailyRecord,readDailyRecord;
JButton getPicture;
File dir;
Color backColor= ;
public CalendarWindow(){
dir=new File("./dailyRecord");
();
showDay=new JTextField[42];
for(int i=0;i<;i++){
showDay[i]=new JTextField();
showDay[i].setBackground(backColor);
showDay[i].setLayout(new GridLayout(3,3));
showDay[i].addMouseListener(this);
showDay[i].addFocusListener(this);
}
calendarMessage=new CalendarMessage();
calendarPad=new CalendarPad();
notePad=new NotePad();
Calendar calendar=();
(new Date());
year=;
month=+1; day=;
(year);
(month);
(day);
(calendarMessage);
(showDay); (year,month,day);
();
doMark(); calendarImage=new CalendarImage();
(new File(""));
clock=new Clock();
JSplitPane splitV1=new JSplitPane,calendarPad,calendarImage); JSplitPane splitV2=new JSplitPane,notePad,clock);
JSplitPane splitH=new JSplitPane,splitV1,splitV2); add(splitH,; showYear=new JTextField(""+year,6);
(new Font("TimesRoman",,12));
J
showMonth=new JTextField(""+month,4); (new
Font("TimesRoman",,12));
J
nextYear=new JButton(" 下年"); previousYear=new JButton(" 上年"); nextMonth=new JButton(" 下月"); previousMonth=new JButton(" 上月");
(this);
(this);
(this);
(this);
JPanel north=new JPanel();
(previousYear);
(showYear);
(nextYear);
(previousMonth);
(showMonth);
(nextMonth);
add(north,;
saveDailyRecord=new JButton("
deleteDailyRecord=new JButton("
readDailyRecord=new JButton("
(this);
(this);
(this); JPanel pSouth=new JPanel();
(saveDailyRecord);
(deleteDailyRecord);
(readDailyRecord); add(pSouth,;
getPicture=new JButton(" 选择日历图像 "); (this);
(getPicture); add(pSouth,;
setVisible(true); setBounds(60,60,660,480);
保存日志 "); 删除日志 "); 读取日志 ");