import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class pendel2 extends Applet implements MouseListener, Runnable{ int pyX=250; int pyY=30; int pX=250; int pY; int s=1; int m=0; int pnX, pnY; int psuurus=70; int pendlipikkus=300; int laius=500; boolean veel=false; double nurgamuut=Math.toRadians(2); double nurk=Math.toRadians(380); double nurk2=0; double nv=Math.toRadians(0); double n2=0; double a; TextField tx=new TextField(""); public pendel2(){ addMouseListener(this); add(tx); } public void mousePressed(MouseEvent e){} public void mouseReleased(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void mouseClicked(MouseEvent e){ if(m%2>0){ veel=false; pyX=e.getX(); pyY=e.getY(); m++; }else{ veel=true; pX=e.getX(); pY=e.getY(); pendlipikkus=(int)Math.sqrt((pX-pyX)*(pX-pyX)+(pY-pyY)*(pY-pyY)); a=pendlipikkus; nurk2=Math.asin(Math.toRadians((pY-pyY)/a)); //nurk=Math.toRadians(nurk2); tx.setText(""+nurk); System.out.println(nurk); m++; nv=Math.toRadians(0); new Thread(this).start(); } } public void run(){ liigutaja(); } public void update(Graphics g){ paint(g); } void liigutaja(){ while(veel){ if(nurk>Math.toRadians(390)){ //vasakult paremale s=-1; } if(nurkMath.toRadians(360))nurgamuut=Math.sin((Math.toRadians(390)-nurk)/pendlipikkus*50)+0.005; if(nurk