import java.awt.*; import java.applet.Applet; public class siinus extends Applet{ double x_id[]; double y_id[]; double x; double y; double x1; double y1; double k; int i; int j; public siinus(){ x_id = new double[100]; for(int k=0; k<100; k++){ x_id[k]=Math.PI*8*0.01*k; } y_id = new double[100]; for(int k=0; k<100; k++){ y_id[k]=Math.sin(x_id[k]); } } public void paint(Graphics g){ g.setColor(Color.black); for(int t=0; t<100; t++){ for(int k=0; k<100; k++){ x1=x_id[k]*25; if(k+t<=99){ //System.out.println(t); //System.out.println(k); y1=y_id[k+t]*25; } if(k+t>99){ y1=y_id[k-t]*25; } i=(int)(x1); j=(int)(y1); g.fillOval(i,j+50,4,4); } try{Thread.sleep(200);}catch(Exception e){} g.setColor(Color.blue); g.fillRect(0,0,600,300); g.setColor(Color.black); if(t==49){t=0;} } } public static void main(String argumendid[]){ Frame f=new Frame("Esimene"); f.setSize(600, 300); f.setBackground(Color.blue); f.add(new siinus()); f.setLocation(200, 100); f.setVisible(true); } }