import java.util.*; import java.awt.*; import java.applet.*; public class kell extends Applet implements Runnable{ Thread Kell; int vxs, vys, vxm, vym, vxh, vyh; Date aeg; int mode; TextField tund; TextField min; public void init(){ tund=new TextField(2); add(tund); min=new TextField(2); add(min); int x,y; vxs=vys=vxm=vym=vxh=vyh=0; aeg = new Date(); mode = 1; } public void paint(Graphics g){ int xh, yh, xm, ym, xs, ys, s=40, m=40, h=50, xkesk, ykesk, xsei, ysei; /* if (mode==1){ aeg=new Date(); } */ try{ h=Integer.parseInt(tund.getText().trim()); m=Integer.parseInt(min.getText().trim()); }catch(Exception e){ System.out.println("kellajama"); } xkesk=100; ykesk=200; xs=(int)(Math.cos(s*3.14f/30-3.14f/2)*45+xkesk); ys=(int)(Math.sin(s*3.14f/30-3.14f/2)*45+ykesk); xm=(int)(Math.cos(m*3.14f/30-3.14f/2)*40+xkesk); ym=(int)(Math.sin(m*3.14f/30-3.14f/2)*40+ykesk); xh=(int)(Math.cos((h*30+m/2)*3.14f/180-3.14f/2)*30+xkesk); yh=(int)(Math.sin((h*30+m/2)*3.14f/180-3.14f/2)*30+ykesk); g.setColor(Color.blue); g.drawOval(xkesk-50,ykesk-50, 150, 150); g.setColor(Color.red); g.drawString("9", xkesk-45, ykesk+30); g.drawString("3", xkesk+90, ykesk+29); g.drawString("12", xkesk+20, ykesk-32); g.drawString("6", xkesk+20, ykesk+95); g.setColor(Color.blue); g.drawLine(xkesk+10, ykesk+95, xkesk, ykesk+110); g.drawLine(xkesk+35, ykesk+95, xkesk+45, ykesk+110); xsei=127; ysei=227; g.setColor(Color.green); g.drawLine(xsei, ysei, xs, ys); g.setColor(Color.black); g.drawLine(xsei, ysei-1, xm, ym); g.drawLine(xsei-1, ysei, xm, ym); g.setColor(Color.gray); g.drawLine(xsei, ysei-1, xh, yh); g.drawLine(xsei-1, ysei, xh, yh); } public void start(){ Kell=new Thread(this); Kell.start(); } public void stop(){ Kell=null; } public void run(){ Thread me=Thread.currentThread(); while (Kell==me){ try{ Thread.currentThread().sleep(500); } catch (InterruptedException e){ } repaint(); } } public void update(Graphics g){ paint(g); } }