import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Soda extends Applet implements ActionListener{ TextField tf=new TextField(""); public Soda(){ add(tf); tf.addActionListener(this); } public void paint(Graphics ek){ int arv=Integer.parseInt(tf.getText().trim()); int a=100; while (arv>0) { ek.setColor(Color.red); ek.fillArc(100+a,100,40,40,0,360); ek.setColor(Color.black); ek.drawLine(120+a,240,120+a,140); ek.drawLine(100+a,200,120+a,140); ek.drawLine(140+a,200,120+a,140); ek.drawLine(100+a,320,120+a,240); ek.drawLine(140+a,320,120+a,240); a=a+100;arv=arv-1; } } public static void main(String argumendid[]){ Frame f=new Frame(" -- Sõjavägi -- "); f.add(new Soda()); f.setBackground(Color.lightGray); f.setSize(600, 500); f.setVisible(true); } public void actionPerformed(ActionEvent e){ repaint(); } }