java日历课程设计报告

  • 格式:wps
  • 大小:160.05 KB
  • 文档页数:15

软件学院
课程设计报告书
课程名称面向对象课程设计
设计题目
专业班级
学号
姓名
指导教师
年 1 月
int selYear1=Integer.parseInt(calLis.Year.getSelectedItem());
int selYear = selYear1- 1900;
Date d1 = new Date(selYear,selMonth,1);
int day = d1.getDay();
calLis.setVal(d1,day,selMonth,selYear);
}
}
class myAction implements ActionListener
{
CalenderCreator calAc;
int newyear;
public myAction(CalenderCreator ca
{
calAc=ca;
}
//为“关闭”按钮添加监听事件,当“关闭”按钮被点击时就执行这里的部分public void actionPerformed(ActionEvent e)
{
String s=calAc.textfield.getText();
// newyear=Integer.parseInt(s);
System.out.println("Year upto::::::::"+s);
calAc.setYear(s);
TextField tf = (TextField)e.getSource();
tf.removeActionListener(this);
}
}
4.3用图片辅助认识程序的具体操作和执行
图4-1:月份和年份的效果图
图4-2:星期的效果图
图4-3:日期的效果图
图4-4:日历整体效果图
4.4附注完整程序设计
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class CalenderCreator extends Frame
{
Button days[]=new Button[49];
Choice Month=new Choice();
Choice Year=new Choice();
Label lmonth=new Label("MONTH");
Label lyear=new Label("Year");
Label ltext=new Label("YEAR UPTO");
Panel p1,p2;
GregorianCalendar gc=new GregorianCalendar();
int totdays;
TextField textfield=new TextField(2);
public CalenderCreator()
{
setTitle("日历");
setSize(400,400);。