import java.awt.*; import java.awt.event.*; public class Tilk3 extends Frame implements MouseListener{ public void mousePressed(MouseEvent e){ int x=e.getX(); int y=e.getY(); new Tilk3Loim(x, y, getGraphics()).start(); } public void mouseReleased(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void mouseClicked(MouseEvent e){} static void joonistaTilk(Graphics g, int x, int y){ g.fillOval(x, y, 10, 10); Polygon p=new Polygon(); p.addPoint(x, y+5); p.addPoint(x+10, y+5); p.addPoint(x+5, y-10); g.fillPolygon(p); } public static void main(String argumendid[]){ Tilk3 f=new Tilk3(); f.setSize(300, 300); f.setVisible(true); f.addMouseListener(f); } } class Tilk3Loim extends Thread{ int x, y; Graphics g; public Tilk3Loim(int ux, int uy, Graphics ug){ x=ux; y=uy; g=ug; } public void run(){ double vahe=0.5; for(;y<250; y=(int)(y+vahe), vahe=vahe+0.2){ g.setColor(Color.blue); Tilk3.joonistaTilk(g, x, y); try{ Thread.sleep(30); }catch(Exception ex){} g.setColor(Color.white); Tilk3.joonistaTilk(g, x, y); } for(int d=10; d>0; d--){ g.setColor(Color.blue); g.fillOval(x, y, d, d); try{ Thread.sleep(30); }catch(Exception ex){} g.setColor(Color.white); g.fillOval(x, y, d, d); } } }