code: public void setEnabled (boolean enabled)
      {
          // report incorrect usage
          if (enabled && _target == null) {
              log.warning("Attempt to enable uninitialized keyboard manager!", new Exception());
              return;
          }
  
          // ignore NOOPs
          if (enabled == _enabled) {
              return;
          }
  
          if (!enabled) {
              if (Keyboard.isAvailable()) {
                  // restore the original key auto-repeat settings
                  Keyboard.setKeyRepeat(_nativeRepeat);
              }
  
              // clear out all of our key states
              releaseAllKeys();
              _keys.clear();
  
              // cease listening to all of our business
              if (_window != null) {
                  _window.removeWindowFocusListener(this);
                  _window = null;
              }
              _target.removeAncestorListener(this);
  
              // note that we no longer have the focus
              _focus = false;
  
          } else {
              // listen to ancestor events so that we can cease our business
              // if we lose the focus
              _target.addAncestorListener(this);
  
              // if we're already showing, listen to window focus events,
              // else we have to wait until the target is added since it
              // doesn't currently have a window
              if (_target.isShowing() && _window == null) {
                  _window = SwingUtilities.getWindowAncestor(_target);
                  if (_window != null) {
                      _window.addWindowFocusListener(this);
                  }
              }
  
              // assume the keyboard focus since we were just enabled
              _focus = true;
  
              if (Keyboard.isAvailable()) {
                  // note whether key auto-repeating was enabled
                  _nativeRepeat = Keyboard.isKeyRepeatEnabled();
  
                  // Disable native key auto-repeating so that we can definitively ascertain key
                  // pressed/released events.
                  // Or not, if we've discovered we don't want to.
                  Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat);
              }
          }
  
          // save off our new enabled state
          _enabled = enabled;
      }
docs: Sets whether the keyboard manager processes keyboard input.