import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class kt2 extends Applet implements ActionListener{ int nr=8; TextField tf=new TextField("8"); public kt2(){ add(tf); tf.addActionListener(this); } public void actionPerformed(ActionEvent e){ nr=Integer.parseInt(tf.getText().trim()); repaint(); } public void paint(Graphics g){ g.drawOval(50, 50, 50, 50); int b=25; for(int i=0; i<(nr); i++){ double a=2*Math.PI/nr*i; int x=(int)(25*(Math.cos(a))); int y=(int)(25*(Math.sin(a))); g.drawLine(75, 75, 75+ x, 75+ y); } } public static void main(String argumendid[]){ Frame f=new Frame("Ratta Kodarad"); f.setSize(300, 300); f.add(new kt2()); f.setVisible(true); } }