title: Java listeners - Mouse left-press not registering while typing
body: <p>I am writing an application engine but I've found a problem in the event registering system. It seems like when typing on the keyboard and pressing the mouse left button, the window doesn't register the mouse press. But when I press the right mouse button while typing on the keyboard it actually registers.</p>
  
  <p>To somewhat summarize the code:</p>
  
  <pre><code>import java.awt.Dimension;
  import java.awt.event.KeyEvent;
  import java.awt.event.KeyListener;
  import java.awt.event.MouseEvent;
  import java.awt.event.MouseListener;
  import java.awt.event.MouseMotionListener;
  import javax.swing.JFrame;
  
  public class BasicEventTest implements KeyListener, MouseListener, MouseMotionListener {
  
      JFrame frame;
  
      /*********************************************** INPUT HANDLING ***********/
      public void keyPressed(KeyEvent k) {
          System.out.println(k.getKeyCode());
      }
      public void keyReleased(KeyEvent k) {}
      public void keyTyped(KeyEvent k) {}
  
      public void mousePressed(MouseEvent m) {
          System.out.println("MOUSEPRESS " + m.getButton());
      }
      public void mouseReleased(MouseEvent m) {}
      public void mouseMoved(MouseEvent m) {}
      public void mouseDragged(MouseEvent m) {}
      public void mouseEntered(MouseEvent m) {}
      public void mouseExited(MouseEvent m) {}
      public void mouseClicked(MouseEvent m) {}
  
      /**************************************************** CONSTRUCTOR *********/
      public BasicEventTest() {
          frame = new JFrame("BasicEventTest");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setPreferredSize(new Dimension(640, 480));
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setResizable(false);
          frame.setVisible(true);
          frame.createBufferStrategy(2);
          frame.setIgnoreRepaint(true);
  
          frame.addKeyListener(this);
          frame.addMouseListener(this);
          frame.addMouseMotionListener(this);
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          BasicEventTest test = new BasicEventTest();
      }
  }
  </code></pre>
  
  <p>SOLVED:
  Apparently in Windows 10, there's a setting in PC Settings->PC and devices->Mouse and touchpad, which controls the delay for registering clicks or moving the mouse after typing.</p>