The Java code is right here.
- import java.awt.*;
- import java.applet.*;
- import java.awt.event.*;
-
-
-
- public class Demo extends Applet
- {
- int x, y;
- public void init()
- {
- add a = new add();
- addMouseListener(a);
- }
- public void paint(Graphics g)
- {
- g.fillOval(x, y, 20, 20);
- }
- class add implements MouseListener
- {
- public void mouseClicked(MouseEvent e) {}
- public void mouseEntered(MouseEvent e)
- {
- x = e.getX();
- y = e.getY();
- repaint();
- }
- public void mouseReleased(MouseEvent e) {}
- public void mousePressed(MouseEvent e) {}
- public void mouseExited(MouseEvent e) {}
- }
- }
Thank you, keep learning and sharing