Java/JSP万年历编写实例
代码说明:
Java万年历源码, TextField tfYear = new TextField("2004", 5); //显示年份的文本域 Choice monthChoice = new Choice(); //月份选择下拉框 Button btUpdate = new Button("更新"); //更新按钮 GregorianCalendar calendar=new GregorianCalendar(); //日历对象 Font smallFont = new Font("TimesRoman", Font.PLAIN, 15); //显示小字体 Font bigFont = new Font("TimesRoman", Font.BOLD, 50); //显示大字体 String days[] = {"星期日", "星期一", "星期二", "星期三","星期四", "星期五", "星期六"}; String months[] = {"一月", "二月", "三月", "四月","五月", "六月", "七月", "八月", "九月","十月", "十一月", "十二月"}; int daysInMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; //每个月的天数 int searchMonth,searchYear; //查询的年份及月份 public void init(){ setBackground(Color.white); //设置背景颜色 searchMonth = calendar.get(Calendar.MONTH); //得到系统年份 searchYear = calendar.get(Calendar.YEAR); //得到系统月份 add(new Label(" 年:")); //增加组件到Applet tfYear.setText(String.valueOf(searchYear)); //设置文本域文字 add(tfYear); add(new Label(" 月:
下载说明:请别用迅雷下载,失败请重下,重下不扣分!