Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

mouseEntered() doesn't catch the event  RSS feed

 
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!