import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class kukkuvring extends Applet implements MouseListener{ int x=100; int y=100; public kukkuvring(){ addMouseListener(this); } public void paint(Graphics g){ g.drawOval(x, y, 20, 20); } public void mousePressed(MouseEvent e){ x=e.getX(); y=e.getY(); Graphics g=getGraphics(); for(; y<240; y=y+2){ g.setColor(Color.red); //joonistatakse must ring g.fillOval(x, y, 20, 20); g.drawOval(x, y, 20, 20); try{Thread.sleep(50);}catch(Exception ex){} //oodatakse veidi g.setColor(Color.white); //ning kustutatakse see g.fillOval(x, y, 20, 20); g.drawOval(x, y, 20, 20); //valgega üle joonistades } repaint(); } public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public static void main(String[] argumendid){ Frame f=new Frame(); f.add(new kukkuvring()); f.setSize(300, 300); f.setVisible(true); } }