# Uses of Enum Class
javafx.scene.input.KeyCode

Packages that use KeyCode
Package
Description
javafx.application
Provides the application life-cycle classes.
javafx.scene.input
Provides the set of classes for mouse and keyboard input event handling.
javafx.scene.robot
Provides API for simulating user interaction such as typing keys on the keyboard and using the mouse.
jfx.incubator.scene.control.input
Incubates a customization mechanism for the JavaFX Controls utilizing the `InputMap`.

- ## Uses of KeyCode in javafx.application

  Methods in javafx.application with parameters of type KeyCode
  Modifier and Type
  Method
  Description
  `static Optional<Boolean>`
  Platform.`isKeyLocked(KeyCode keyCode)`
  Returns a flag indicating whether the key corresponding to `keyCode` is in the locked (or "on") state.

- ## Uses of KeyCode in javafx.scene.input

  Subclasses with type arguments of type KeyCode in javafx.scene.input
  Modifier and Type
  Class
  Description
  `enum`
  `KeyCode`
  Set of key codes for `KeyEvent` objects.
  Methods in javafx.scene.input that return KeyCode
  Modifier and Type
  Method
  Description
  `final KeyCode`
  KeyCodeCombination.`getCode()`
  Gets the key code associated with this key combination.
  `final KeyCode`
  KeyEvent.`getCode()`
  The key code associated with the key in this key pressed or key released event.
  `KeyCode`
  KeyCombination.Modifier.`getKey()`
  Gets the modifier key of this `Modifier`.
  `static KeyCode`
  KeyCode.`getKeyCode(String name)`
  Parses textual representation of a key.
  `static KeyCode`
  KeyCode.`valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static KeyCode[]`
  KeyCode.`values()`
  Returns an array containing the constants of this enum class, in the order they are declared.
  Constructors in javafx.scene.input with parameters of type KeyCode
  Modifier
  Constructor
  Description
  ``
  `KeyCodeCombination(KeyCode code, KeyCombination.Modifier... modifiers)`
  Constructs a `KeyCodeCombination` for the specified main key and with the specified list of modifiers.
  ``
  `KeyCodeCombination(KeyCode code, KeyCombination.ModifierValue shift, KeyCombination.ModifierValue control, KeyCombination.ModifierValue alt, KeyCombination.ModifierValue meta, KeyCombination.ModifierValue shortcut)`
  Constructs a `KeyCodeCombination` for the specified main key and with an explicit specification of all modifier keys.
  ``
  `KeyEvent(Object source, EventTarget target, EventType<KeyEvent> eventType, String character, String text, KeyCode code, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown)`
  Constructs a new `KeyEvent` event from the specified parameters.
  ``
  `KeyEvent(EventType<KeyEvent> eventType, String character, String text, KeyCode code, boolean shiftDown, boolean controlDown, boolean altDown, boolean metaDown)`
  Constructs a new `KeyEvent` event from the specified parameters, with a `null` source and target.

- ## Uses of KeyCode in javafx.scene.robot

  Methods in javafx.scene.robot with parameters of type KeyCode
  Modifier and Type
  Method
  Description
  `void`
  Robot.`keyPress(KeyCode keyCode)`
  Presses the specified `KeyCode` key.
  `void`
  Robot.`keyRelease(KeyCode keyCode)`
  Releases the specified `KeyCode` key.
  `void`
  Robot.`keyType(KeyCode keyCode)`
  Types the specified `KeyCode` key.

- ## Uses of KeyCode in jfx.incubator.scene.control.input

  Methods in jfx.incubator.scene.control.input that return KeyCode
  Modifier and Type
  Method
  Description
  `KeyCode`
  KeyBinding.`getKeyCode()`
  Returns the `KeyCode`, or null if the key binding is not for a key code.
  Methods in jfx.incubator.scene.control.input with parameters of type KeyCode
  Modifier and Type
  Method
  Description
  `static KeyBinding`
  KeyBinding.`alt(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `alt` key modifier (`option` on macOS).
  `static KeyBinding.Builder`
  KeyBinding.`builder(KeyCode code)`
  Creates a `KeyBinding.Builder` with the specified `KeyCode`.
  `static KeyBinding`
  KeyBinding.`command(KeyCode code)`
  This utility method creates a `KeyBinding` which corresponds to the key press with the specified `KeyCode` and the macOS `⌘ command` key modifier.
  `static KeyBinding`
  KeyBinding.`control(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `ctrl` key modifier (`control` on macOS).
  `static KeyBinding`
  KeyBinding.`controlShift(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `shift` + `ctrl` key modifier (`control` on macOS).
  `static KeyBinding`
  KeyBinding.`of(KeyCode code)`
  Creates a `KeyBinding` which corresponds to the key press with the specified `KeyCode`.
  `static KeyBinding`
  KeyBinding.`option(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `option` key modifier on macOS.
  `static KeyBinding`
  KeyBinding.`shift(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `shift` key modifier.
  `static KeyBinding`
  KeyBinding.`shiftOption(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `shift` + `option` key modifiers on macOS.
  `static KeyBinding`
  KeyBinding.`shiftShortcut(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the `shift` + shortcut key modifier (`⌘ command` on macOS, `ctrl` elsewhere).
  `static KeyBinding`
  KeyBinding.`shortcut(KeyCode code)`
  Creates a KeyBinding which corresponds to the key press with the specified `KeyCode` and the shortcut key modifier (`⌘ command` on macOS, `ctrl` elsewhere).
  `KeyBinding`
  KeyBinding.`withNewKeyCode(KeyCode newCode)`
  Creates a new instance of `KeyBinding` with the new `KeyCode` and the same set of the modifiers.