import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; import java.awt.Frame; public class pendel extends Applet { public void paint(Graphics ekraan){ for(int x=120; x<300; x=x+1){ ekraan.setColor(Color.blue); ekraan.drawLine(120, 50, x, 400-x); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawLine(120, 50, x, 400-x); ekraan.setColor(Color.blue); ekraan.drawOval(x, 400-x, 20, 20); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawOval(x, 400-x, 20, 20); } for(int x=300; x>120; x=x-1){ ekraan.setColor(Color.blue); ekraan.drawLine(120, 50, x, 400-x); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawLine(120, 50, x, 400-x); ekraan.setColor(Color.blue); ekraan.drawOval(x, 400-x, 20, 20); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawOval(x, 400-x, 20, 20); } for(int x=120; x>-30; x=x-1){ ekraan.setColor(Color.blue); ekraan.drawLine(120, 50, x, x+160); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawLine(120, 50, x, x+160); ekraan.setColor(Color.blue); ekraan.drawOval(x, x+160, 20, 20); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawOval(x, x+160, 20, 20); } for(int x=-30; x<120; x=x+1){ ekraan.setColor(Color.blue); ekraan.drawLine(120, 50, x, x+160); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawLine(120, 50, x, x+160); ekraan.setColor(Color.blue); ekraan.drawOval(x, x+160, 20, 20); try{Thread.sleep(50);}catch(Exception e){} ekraan.setColor(Color.white); ekraan.drawOval(x, x+160, 20, 20); } } } //} // public static void main(String argumendid[]){ // Frame f=new Frame("pendel"); // f.add(new pendel()); // f.setSize(400, 400); // f.setVisible(true); //};