import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class click extends Applet implements MouseListener { private int x=40,y=40; private int r=10; public void init() { addMouseListener(this); } public void paint(Graphics g) { g.setColor(Color.white); g.fillRect(0,0,getSize().width,getSize().height); g.setColor(Color.red); g.fillOval(x-r,y-r,r*2,r*2); } public void mousePressed(MouseEvent event) { x=event.getX(); y=event.getY(); repaint(); } public void mouseClicked(MouseEvent event) {} public void mouseReleased(MouseEvent event) {} public void mouseEntered(MouseEvent event) {} public void mouseExited(MouseEvent event) {} }