import java.awt.*;import java.util.*;import java.lang.*;public class uhr extends java.applet.Applet implements Runnable{ GregorianCalendar cal = new GregorianCalendar(); private Thread t = new Thread(this); public int sec=cal.get(Calendar.SECOND); public int min=cal.get(Calendar.MINUTE); public int hou=cal.get(Calendar.HOUR_OF_DAY); public int x1=220; public int y1=220; public int x2; public int y2; public int xsec; public int ysec; public int xmin; public int ymin; public int xhou; public int yhou; public double alpha=0; public double pi=Math.PI; public void start() { t.start(); } public void run() { for (;;) { try { t.sleep(1000); sec=cal.get(Calendar.SECOND); min=cal.get(Calendar.MINUTE); hou=cal.get(Calendar.HOUR_OF_DAY); alpha=0; xsec=(int) (160*Math.sin(pi*sec/30)+x1); ysec=(int) (-160*Math.cos(pi*sec/30)+y1); xmin=(int) (120*Math.sin(pi*min/30)+x1); ymin=(int) (-120*Math.cos(pi*min/30)+y1); xhou=(int) (100*Math.sin(pi*hou/6)+x1); yhou=(int) (-100*Math.cos(pi*hou/6)+y1); repaint(); } catch (Exception e) {}; } } public void paint(Graphics g) { Color rot=new Color(255,0,0); Color weiss=new Color(255,255,255); g.drawString(hou + ":" + min + ":" + sec, 20, 20); g.setColor(rot); g.fillOval(20,20,400,400); g.setColor(weiss); g.fillOval(30,30,380,380); g.setColor(rot); while (alpha<=2*pi) { x2=(int) (198*Math.sin(alpha)+x1); y2=(int) (198*Math.cos(alpha)+y1); g.drawLine(x1,y1,x2,y2); alpha=(alpha+pi/6); } g.setColor(weiss); g.fillOval(40,40,360,360); g.setColor(rot); g.drawLine(x1,y1,xsec,ysec); g.drawLine(x1,y1,xmin,ymin); g.drawLine(x1,y1,xhou,yhou); }}