title: Java MouseListener entered and exited don't update unless I alt tab
body: <p>I have those 2 functions</p>
  
  <pre><code>public void mouseEntered(MouseEvent e) {
  
      int mx = e.getX();
      int my = e.getY();
  
      if(mouseOver(mx, my, Game.WIDTH / 2 - 285, Game.HEIGHT / 2 - 170, Game.hud.materials[1].getWidth(), Game.hud.materials[1].getHeight()))
          isOnMaterial[0] = true;
  
  }
  
  public void mouseExited(MouseEvent e) {
  
      int mx = e.getX();
      int my = e.getY();
  
      if(!mouseOver(mx, my, Game.WIDTH / 2 - 285, Game.HEIGHT / 2 - 170, Game.hud.materials[1].getWidth(), Game.hud.materials[1].getHeight()))
          isOnMaterial[0] = false;
  
  }
  </code></pre>
  
  <p>The <code>mouseOver</code> is a function which I use to set the perimeter which the mouse needs to be in to trigger something. </p>
  
  <p>So when I indeed enter that area, the variable is set to true, and if it is true, a rectangle is drawn with Graphics. That rectangle won't draw though unless I alt tab the window, which is set to full screen like this:</p>
  
  <pre><code>jf.setExtendedState(JFrame.MAXIMIZED_BOTH); 
  jf.setUndecorated(true);
  </code></pre>
  
  <p>This applied to the <code>mouseExited</code> function as well. So when I alt tab in, I see that the rectangle is drawn, and when the mouse exists that area the rectangle is still drawn unless I alt tab again.</p>
  
  <p>Also I know that the problem is on those 2 functions because I tried to <code>System.Out.Println()</code> something when the event is triggered and it only prints on the console once after I alt tab, and I have one more <code>System.Out.Println()</code> on the function which I draw the rectangle and it keeps printing all the time after I alt tab, not only once. (Because of the game loop)</p>
  
  <p>I hope my problem is clear, any ideas?</p>