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