title: Swing Timer stops calling actionPerformed() while the mouse is moving inside a JFrame
body: <p>If I move my mouse inside a <code>javax.swing.JFrame</code>, the <code>javax.swing.Timer</code> stops calling the <code>actionPerformed()</code> method until the mouse stops moving. It only occurs when I move the cursor with my Rocket Kone XTD mouse. When I use my trackpad everything is fine.</p>
  
  <p>How can I fix it? I'm using macOS Sierra.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JFrame;
  import javax.swing.Timer;
  
  public class Mouse {
      public static void main(String[] args) {
          JFrame frame = new JFrame();
  
          frame.setSize(500, 500);
          frame.setVisible(true);
  
          Timer timer = new Timer(10, new ActionListener() {
  
              @Override
              public void actionPerformed(ActionEvent e) {
                  System.out.println("foo");
              }
          });
  
          timer.start();
      }
  }
  </code></pre>
  
  <p>To get an idea what I'm talking about:</p>
  
  <p><a href="https://i.stack.imgur.com/NDmSI.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NDmSI.gif" alt="enter image description here"></a></p>
  
  <h2>Code that gives more detail:</h2>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  
  public class Mouse {
      public static void main(String[] args) {
          // Note: Swing/AWT GUIs should be started on the EDT!
          // If the problem displayed here, that is first change I'd make to code.
          final JFrame frame = new JFrame();
  
          frame.setSize(500, 500);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
  
          Timer timer = new Timer(10, new ActionListener() {
  
              long lastTime = 0;
  
              @Override
              public void actionPerformed(ActionEvent e) {
                  long nowTime = System.currentTimeMillis();
                  long difference = nowTime-lastTime;
                  lastTime = nowTime;
                  Rectangle r = frame.getBounds();
                  Point p = MouseInfo.getPointerInfo().getLocation();
                  System.out.println(String.format("%1s\t%2s", 
                          difference, r.contains(p)));
              }
          });
  
          timer.start();
      }
  }
  </code></pre>
  
  <h2>Output:</h2>
  
  <p>If the mouse is not moving, the output it looks like this:
  11  true
  13  true
  13  true
  10  true
  12  true
  13  true
  12  true
  13  true
  10  true.</p>
  
  <p>While the mouse is moving (fast) there is no output. When the mouse stops moving the output is: 2406    true (depending how long I moved my mouse).</p>
  
  <p>If the mouse is moving slowly, the output looks like this: 17   true
  5   true
  8   true
  16  true
  4   true
  11  true
  16  true
  44  true
  11  true
  28  true
  48  true
  77  true
  11  true
  7   true
  15  true
  8   true
  9   true
  12  true
  24  true
  13  true
  4   true
  12  true
  32  true
  13  true
  8   true
  8   true
  13  true
  10  true
  15  true.</p>
  
  <p><a href="https://i.stack.imgur.com/OCYjZ.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OCYjZ.gif" alt="enter image description here"></a></p>