Im trying to have the center circles follow the mouse if it enters the screen and go back to the original position if the mouse exits screen. Im not sure what to put into my mouse listener and would appeciate some help
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class WatchMe extends JApplet {
public void eyesPoint(){
}
public void init()
{
getContentPane().setBackground(Color.white);
addMouseListener(new MyMouseListener());
addMouseMotionListener(new MyMouseMotionListener());
}
public class MyMouseListener extends MouseAdapter
{
public void mouseEntered(MouseEvent e){
}
}
public class MyMouseMotionListener extends MouseMotionAdapter
{
public void mouseMoved(MouseEvent e){
}
}
public void paint(Graphics g)
{
super.paint(g);
//create outside circle1
g.setColor(Color.black);
g.drawOval(430, 449, 75, 100);
//create outside circle2
g.setColor(Color.black);
g.drawOval(525, 449, 75, 100);
//create inside filled in circle3
g.setColor(Color.black);
g.fillOval(450, 479, 35, 35);
//create inside filled in circle4
g.setColor(Color.black);
g.fillOval(545, 479, 35, 35);
}
//method for when mouse comes in
//method for eyes following the mouse
}