import java.applet.Applet; import java.awt.*; public class Ringid5 extends Applet{ double nurk1=Math.PI/2; double nurk2=Math.PI*7/6; double nurk3=-Math.PI/6; public void joonistaKujund(int keskx, int kesky, int r){ Graphics g=getGraphics(); g.drawOval(keskx-r, kesky-r, 2*r, 2*r); if(r>20){ joonistaKujund(keskx, kesky, r/3); joonistaKujund((int)(keskx+r*2/3*Math.cos(nurk1)), (int)(kesky-r*2/3*Math.sin(nurk1)), r/3); joonistaKujund((int)(keskx+r*2/3*Math.cos(nurk2)), (int)(kesky-r*2/3*Math.sin(nurk2)), r/3); joonistaKujund((int)(keskx+r*2/3*Math.cos(nurk3)), (int)(kesky-r*2/3*Math.sin(nurk3)), r/3); } } public void paint(Graphics g){ joonistaKujund(getWidth()/2, getHeight()/2, Math.min(getWidth()/2, getHeight()/2)); } public static void main(String argumendid[]){ Frame f=new Frame(); f.add(new Ringid5()); f.setSize(300, 300); f.setVisible(true); } }