import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Klahv extends Applet implements MouseListener{ int x=100; int y=100; public Klahv(){ addMouseListener(this); } public void paint(Graphics g){ g.setColor(Color.red); g.fillOval(x-5, y-5, 10, 10); } public void mousePressed(MouseEvent e){ x=e.getX(); y=e.getY(); repaint(); } public void mouseReleased(MouseEvent e){ Graphics g=Klahv.this.getGraphics(); g.setColor(Color.white); g.fillOval(x-5, y-5, 10, 10); } 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 Klahv()); f.setSize(200, 200); f.setVisible(true); } }