import java.applet.Applet; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class pallivise extends Applet implements ActionListener { TextField nurk=new TextField ("100"); Button nupp=new Button ("OK"); public void init(){ add(nurk); add(nupp); nupp.addActionListener(this); } public void actionPerformed (ActionEvent e){ int nr=Integer.parseInt(nurk.getText().trim()); double kraad = nr/57.1; //Math.toRadians((double)nr); System.out.println(""+kraad); Graphics g=this.getGraphics(); g.setColor (Color.white); g.fillRect(0, 0, getSize().width, getSize().height); for(int x=40; x<500; x=x+2){ g.setColor(Color.black); g.fillOval(x, getSize().height - (int)(Math.atan(kraad)*x), 20, 20); try{Thread.sleep(50); } catch(Exception k){} g.setColor(Color.white); g.fillOval(x, getSize().height - (int)(Math.atan(kraad)*x) , 20, 20); } } }