import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class LiikuvRing extends Applet implements ActionListener{ final int keskx=100; final int kesky=200; final int r=10; TextField tf1=new TextField(10); public LiikuvRing(){ add(tf1); tf1.addActionListener(this); } public void actionPerformed(ActionEvent syndmus){ Graphics g=getGraphics(); double nurk= Math.toRadians(Double.parseDouble(tf1.getText())); for(double k=0; k<240; k=k+2){ int x=(int)(k*Math.cos(nurk)); int y=(int)(k*Math.sin(nurk)); g.setColor(Color.black); g.drawOval(keskx+x-r, kesky-y-r, 2*r, 2*r); try{Thread.sleep(50);}catch(Exception e){} g.setColor(Color.white); g.drawOval(keskx+x-r, kesky-y-r, 2*r, 2*r); } } public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new LiikuvRing()); f.setSize(300, 300); f.setVisible(true); } }