import java.awt.*; import java.awt.event.*; //hiire jaoks vaja import java.applet.Applet; public class kaste3 extends Applet { public kaste3(){ addMouseListener(new HiireKuular()); //et hiirvajutuse teadetele reageeritaks } public void paint(Graphics g){ g.drawRect(80, 30, 50, 100); g.drawLine(28, 28 , 80, 110); g.drawLine(28, 23 , 80, 90); g.drawOval(130, 50, 20, 50); g.drawLine(28, 28 , 28, 23); g.setColor(Color.green); g.drawLine(0, 131 , 200, 131); g.setColor(Color.white); g.drawRect(131, 31, 48, 98);} class HiireKuular extends MouseAdapter{ public void mousePressed(MouseEvent e){ try{ //veapüünis int x=23; int y=26; int dy=0; Graphics g=getGraphics(); while(y<130){ // Joonistusala suurus g.setColor(Color.blue); g.drawOval(x, y, 5, 5); Thread.sleep(100); //ooteaeg millisekunditess g.setColor(Color.white); g.drawOval(x, y, 5, 5); dy=dy+1; y=y+dy; } }catch (Exception probleem){ System.out.println(probleem); } } } public static void main(String argumendid[]){ Frame f=new Frame("Kastekann"); f.setSize(200, 200); f.add(new kaste3()); f.setVisible(true); } }