import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Kell1 extends Applet{ int keskx, kesky; int ringiraadius; static final long serialVersionUID=1; public void paint(Graphics g){ keskx=getWidth()/2; kesky=getHeight()/2; //ringiraadius=Math.min(getWidth(), getHeight())/3; ringiraadius=100; g.drawOval(keskx-ringiraadius, kesky-ringiraadius, ringiraadius*2, ringiraadius*2); double nurk=Math.toRadians(30); double dy=Math.sin(nurk)*ringiraadius; double dx=Math.sqrt(dy*dy+ringiraadius*ringiraadius- 2*dy*ringiraadius*Math.cos(3.14/2-nurk)); g.drawString("2", keskx+(int)dx, kesky-(int)dy); nurk=Math.toRadians(60); dy=Math.sin(nurk)*ringiraadius; dx=Math.sqrt(dy*dy+ringiraadius*ringiraadius- 2*dy*ringiraadius*Math.cos(3.14/2-nurk)); g.drawString("1", keskx+(int)dx, kesky-(int)dy); System.out.println(dx+" "+dy); //Joonista sobivasse kohta number 1 //Joonista täisring numbreid } public static void main(String[] arg){ Frame f=new Frame("Kell"); f.add(new Kell1()); f.setSize(400, 400); f.setVisible(true); f.addWindowListener( new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } } ); } }