hlsetForeground(Color.WHITE); p2add(hl); } publicvoid paint(Graphics g) { String lasttoday二””; int xh,yh,xm,ym,xs,v5nter;ycenter; Date rightnow=new Date(); String today=rightnow.toString(); h=lnteger.parselnt(todaysubstring(ll」3)); m=dn teger.par^elntftodaysubstri ng(14,16)); s =ln tege r.pa rselnt(toda y.s ubstri ng( 17,19)); xcenter=300; ycen ter=160; xs=(int)(Math.cos (s*3.14f/30-3.14f/2) *45+xce nter); ys=(int)(Math^in(s<,3.14f/30-3,W2)*45+ycenter); xm=(int)(Math.cos(m*3.14f/30-3.14f/2)*40+xoenter); ym=(int)(Math5in(mt3.14f/30-3.14f/2) *40+yoe nte r); ,xh=(int)(Math.cos((hJ>30+m/2)*3.14f7180-3.14f/2),t30+xce nter); yh=(int)(Math^in((h#30*m/2)*3.14f/180-3.14f/2)*30+ycenter); g.setFont(new Font(*TimesRoman\zFont.PLAINz14)); gse tCol or(Colo r.B LACK); 20
g.drawArc(xce n te 卜 50,ycenter?50,100,1000360); g5etColor(Color.darkGray);
g.drawString(H9\rxcenter-45zyce nter+3); g?drawSiring「3”,xcenter+40,ycenter+3);
g.drawString(,,12,,/xoe nter-5#ycenter-3 7);
g.drawStri ngf'6':xce nter?3”center+45);
g5etColor(color);
if(xs!=lastxs| |ys Hastys)
{
g.drawLinefxcenteGycenteGlastxsJastys);
}
if(xm!=iastxm| lymHastym)
{
g.drawU ne(xce nteDYcenterJastxmJasWm); g.drawlj ne(xoenter?l,yce nterjastxmjastym);
}
if(xh!=lastxh| |yh!=last\\h)
{
g.drawlj ne(xce nter;ycenter?lJastxh」asM);
g.drawlj ne(xce nte 卜 l^ycentedastxhjast^h);
}
g.drawString(lasttoda ^5,150);
gsetColor(Color.darkGray);
//g.drawString(toda ^5,150);
g se t Col o r( Col o r.BLACK); g.drawLine(xcentecyce nter,xs,ys);
21
g.drawLinefxcentecyoenter-l^xm.ym); g.drawLi ne(xce nter?l“ce nter,xm,ym); g.drawLi ne(xcenter;yoenter?
l,xh,yh); g.drawlinefxcenter-l.ycenteGxh,^); lastxs=xs;
lastys=ys;
lastxm=xm;
lastym=ym;
lastxh=xh;
lastyh=yh;
lasttoday=today;
}
public void updateQ
{
paint(g);
}
public void run() 22
StringsO;
while(true)
// Date temp=new Date();
sO=new String (new Date().toString());
s O=s Osubstri ng( 10,20);
tl.se tColumns(lO);
tl.setlextfsO);
paint(g);
try
{
Th read.sleep( 1000);
catch (Exception e)
}
public void itemStateCha nged(ItemEvent e)
{
if(e ?ge tSou roe ()==month)
{ int m=12; for(inti=Oj<=llj++) 23
{ if (mon th tSel ected I te m () .compa relo( JJ[i])==O) { m=i+l; Y=2OO8; Y=ln teger.pa(selnt(sl.get\\^lue().toStri ng()); break; } } update b3setEnabled(toje); } } public void acti onPerformed(ActionE\\^ nte) { if(e.getSource()==bl| |e?etSource()==b2) { System.exit(O); } else i f(e .ge 6ou rce 0==b3) { b35etEnabled(false); public void state Cha nged (Change Eve nte) if(e.ge6ource()==model3) int Y=2OO8ZM=12; Y=lnteger.parselnt(sl.get\\felue().toString());
24