import java.awt.*; import java.awt.event.*; public class Liigu2 extends Frame implements MouseMotionListener{ Image pilt; Graphics piltg; public Liigu2(){ setSize(300, 300); setVisible(true); addMouseMotionListener(this); addMouseListener(new Liigu2kuular(this)); } public void paint(Graphics g){ pilt=createImage(getSize().width, getSize().height); piltg=pilt.getGraphics(); } public void mouseMoved(MouseEvent e){} public void mouseDragged(MouseEvent e){ Graphics g=this.getGraphics(); g.drawImage(pilt, 0, 0, this); g.drawOval(e.getX()-5, e.getY()-5, 10, 10); } public static void main(String argumendid[]){ new Liigu2(); } } class Liigu2kuular extends MouseAdapter{ Liigu2 peremees; public Liigu2kuular(Liigu2 l2){ peremees=l2; } public void mouseReleased(MouseEvent e){ peremees.piltg.drawOval(e.getX()-5, e.getY()-5, 10, 10); } }