import java.applet.Applet; import java.awt.*; public class Pallekr extends Applet{ int x=20; int samm=2; public void paint(Graphics g){ while(3>2){ if(x>270){ samm=-samm; } if(x<0){ samm=-samm; } x=x+samm; g.setColor(Color.black); //joonistatakse must ring g.drawOval(x, 90, 20, 20); try{Thread.sleep(50);}catch(Exception e){} //oodatakse veidi g.setColor(Color.white); //ning kustutatakse see g.drawOval(x, 90, 20, 20); //valgega üle joonistades } } public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new Pallekr()); f.setSize(300, 300); f.setVisible(true); } }