Detecting mouse enter/exit events anywhere on JPanel

Posted by Mano on Stack Overflow See other posts from Stack Overflow or by Mano
Published on 2010-03-15T05:32:10Z Indexed on 2010/03/15 5:39 UTC
Read the original article Hit count: 155

Filed under:

Hi,

Basically there is a JPanel on which I want to know when the mouse enters the area of the JPanel and exits the area of the JPanel. So I added a mouse listener, but if there are components on the JPanel and the mouse goes over one of them it is detected as an exit on the JPanel, even though the component is on the JPanel. I was wondering whether anyone knows any way to solve this problem without doing something like adding listeners onto all components on the JPanel?

© Stack Overflow or respective owner

Related posts about java