title: How to stop auto clicker upon pressing a Key
body: <pre><code>@Override
      public void keyPressed(KeyEvent e) {
  
  
  
          if ( e.getKeyChar() == 'x' ) {
              Clicking = true;
          }
              try {
                  if(Clicking == true)
                  robot = new Robot();
                  while (true) {
                      robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
                      robot.delay(1000);
                      robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
                      if(e.getKeyChar() == 'b'){
                          Clicking = false;
                      }
                  } } catch(AWTException awtException) {
                  awtException.printStackTrace();
  
                 }
              }
  </code></pre>
  <p>I'm trying to make it so whenever I press b the autoclicker stops it works when I press x but doesn't stop after I press b</p>