接着上面的部分,下面是applet主程序部分:
【程序编程相关:用存储过程执行Insert和直接执行In】 【推荐阅读:设计模式实战(一)——使用策略模式(st】 【扩展信息:ASP漏洞分析和解决方法】public class myclock extends applet implements runnable
{ static final int background=0; //背景图片的序号,供数组使用 static final int logo=1; //logo图片的序号,供数组使用 static final string javex="bear"; //表盘上显示的文字 static final double minsec=0.104719755; //分针与秒针在表盘上的刻度(60个)间的弧度 static final double hour=0.523598776; //时针在表盘上的刻度(24个)间的弧度thread clockthread = null; //使用多线程机制,用另一个线程不断显示图片
//提供的默认参数,如果html文件里面没有给参数就使用
int width = 100; int height = 100; color bgcolor = new color(0,0,0); color facecolor = new color(0,0,0); color sweepcolor = new color(255,0,0); color minutecolor = new color (192,192,192); color hourcolor = new color (255,255,255); color textcolor = new color (255,255,255); color casecolor = new color (0,0,0); color trimcolor = new color (192,192,192); string logostring=null;image images[] = new image[2]; //背景与logo的图片
boolean ispainted=false; //如果第一次载入时绘制背景及表盘,其他时候重绘则只绘制指针
//时钟圆心的位置
int x1,y1;//最上面那个三角形的刻度图形的坐标
int xpoints[]=new int[3], ypoints[]=new int[3];//保存当前时间,转换成(double)(hours + minutes/60)
hms cur_time;//秒针.分针.时针
sweephand sweep; hmhand minutehand, hourhand;//用于绘制的时.分.秒
double lasthour; int lastminute,lastsecond;//显示日期与表盘上的字母的字体
font font;//图片显示使用了缓冲机制,offscrimage与offscrgc存放缓冲区内图片的信息
image offscrimage; graphics offscrgc;//用于测试背景图片与logo图片
mediatracker tracker; int mindimension; // 如果背景区域不是正方形的话,保证时钟在中间显示 int originx; // 时钟图形所在正方形区域的左上角x坐标 int originy; // 时钟图形所在正方形区域的左上角y坐标double tzdifference=0; //时区间的差,向西为负数,向东为正数
boolean localonly=false; //是否只使用本地时间,如果为false则可以根据传入的时区显示该时区时间
//保存参数的类型说明 public string[][] getparameterinfo() { string[][] info = { {"width", "int", "applet的长度,以象素为单位"}, {"height", "int", "applet的宽度,以象素为单位"}, {"bgcolor", "string", "背景颜色,e.g ff0000"}, ... 下一页