I'm having some issues with getting my mouse events to work. I have a JPanel inside of a JLayeredPane which is in a JScrollPane. Admittedly, I am fairly new to working with Swing, but essentially, I want the JPanel to react to the mouse moving, but have been unable to get it to work.
public class CellHighlighter extends JPanel implements MouseMotionListener{
public CellHighlighter(){
}
public void mouseMoved(MouseEvent evt){
System.out.println(evt.getPoint().x + ", " + evt.getPoint().y);
}
public void mouseDragged(MouseEvent evt){System.out.println("message");}
}
Any help would be much appreciated, thanks in advance!