java source code
import java.applet.Applet; import java.awt.*; import java.util.*; public class CalendarApplet extends Applet{ static final int TOP = 70; //顶端距离 static final int CELLWIDTH=50,CELLHEIGHT = 30; //单元格尺寸 static final int MARGIN = 3; //边界距离 static final int FEBRUARY = 1; TextField tfYear = new TextField("2011", 5); //显示年份的文本域 //Choice monthChoice = new Choice(); //月份选择下拉框 TextField tfMonth = new TextField("5"); 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[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; String months[] = {" ","1", "2", "3", "4","5", "6", "7", "8", "9","10", "11", "12"}; int daysInMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; //每个月的天数 int searchMonth,searchYear; //查询的年份及月份 public void init()
贴上一期万年历的源代码,与君共享(160行,原创,虽然是简单的applet)
最新推荐文章于 2023-10-29 10:40:36 发布
这篇博客分享了一款基于Java Applet的万年历程序,源代码仅160行,适用于JDK7环境,并在Eclipse Helios 3.2和Windows 7上运行。开发者可以借此学习到如何创建简单的GUI日历应用。
摘要由CSDN通过智能技术生成