import java.awt.*; import java.applet.*; import java.awt.event.*; import java.util.Date; import java.lang.Long; public class hiir extends Applet implements MouseListener{ TextField tf=new TextField(10); double hx, hy, x=200, y=200, klikk=0, r=10; long aeg, algaeg=0, loppaeg; boolean lopp=false; int arv=5; public hiir(){ addMouseListener(this); Panel p=new Panel(new GridLayout(3, 2)); p.add(new Label("Aeg:")); p.add(tf); add(p); } public void paint(Graphics ekraan){ ekraan.setColor(getBackground()); ekraan.fillRect(0, 0, 400, 400); ekraan.setColor(getForeground()); ekraan.drawOval((int)(x-r), (int)(y-r), (int)(2*r), (int)(2*r)); } public void mousePressed(MouseEvent e){ if(algaeg==0){ algaeg=new Date().getTime(); } hx=e.getX(); hy=e.getY(); double xkaugus=hx-x, ykaugus=hy-y; if (klikk==arv-1){ x=500; y=500; }else if( Math.sqrt(xkaugus*xkaugus+ykaugus*ykaugus)