Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

mouseEntered() doesn't catch the event

 
Ulvi Cetin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to implement mouseEntered and mouseExited methods. The mouseEntered method some times see some times doesn't see the mouse entered in the rectangular area. Here are the code for mouseEntered and mouseExited:
public void mouseEntered(MouseEvent e) {
Point p = e.getPoint();
if (r1.contains(p)) {
setR1 = true;
repaint();
}
}
public void mouseExited(MouseEvent e) {
Point p = e.getPoint();
if (r1.contains(p) && setR1) {
setR1 = false;
repaint();
}
}
r1 is a Rectagle object and setR1 is boolean.
Any ideas why the mouseEntered sometimes work, sometimes doesn't.
Thx.
Ulvi.
 
Create symphonies in seed and soil. For this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!