import java.awt.*; import java.awt.event.*; public class Liigu23 extends Frame implements MouseMotionListener{ Image pilt; Graphics piltg; public Liigu23(){ setSize(300, 300); setVisible(true); addMouseMotionListener(this); addMouseListener(new Liigu23kuular(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.drawString("+",e.getX()-100,e.getY()-100); } public static void main(String argumendid[]){ new Liigu23(); } } class Liigu23kuular extends MouseAdapter{ Liigu23 peremees; public Liigu23kuular(Liigu23 l2){ peremees=l2; } public void mouseReleased(MouseEvent e){ peremees.piltg.drawString("+",e.getX()-100,e.getY()-100); } }