import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Animatsioonid extends Applet implements Runnable{ int x=100; int y=100; public Animatsioonid(){ new Thread(this).start(); } public void paint(Graphics g){ g.drawOval(x, y, 10, 10); } public void run(){ while(true){ try{Thread.sleep(30);} catch(Exception viga){} if(x<=150 && y==100){x=x+1;} if(y<=150 && x==150){y=y+1;} if(x>=100 && y==150){x=x-1;} if(y>=100 && x==100){y=y-1;} repaint(); } } public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new Animatsioonid()); f.setSize(500, 500); f.setVisible(true); } }