import java.awt.*; import java.applet.*; import java.awt.event.*; public class Liikumine1 extends Applet implements ActionListener{ TextField tf=new TextField(10); public Liikumine1(){ add(tf); tf.addActionListener(this); } public void actionPerformed(ActionEvent e){ try{ //veapüünis int x=10; int y=100; Graphics g=getGraphics(); while(x<300){ g.setColor(Color.black); g.drawOval(x, y, 10, 10); Thread.sleep(300); //ooteaeg millisekundites g.setColor(Color.white); g.drawOval(x, y, 10, 10); x=x+5; } } catch (Exception probleem){ System.out.println(probleem); } } public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new Liikumine1()); f.setSize(300, 300); f.setVisible(true); } }