Annotation Interface OnKey


Methods annotated with this annotation will be called upon a key event. The key event can be specified by the parameters of this annotation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Possible targets for registering key events.
    static enum 
    Enum representation for different KeyEvent types.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the alt key has to be pressed (see strict()).
    The character of the key event.
    javafx.scene.input.KeyCode
    The code of the key event.
    boolean
    Whether the control key has to be pressed (see strict()).
    boolean
    Whether the meta key has to be pressed (see strict()).
    boolean
    Whether the shift key has to be pressed (see strict()).
    boolean
    Whether the settings for meta, control, alt and shift keys are strict.
    The target at which the event should be handled.
    The text of the key event.
    The type of the event.
  • Element Details

    • code

      javafx.scene.input.KeyCode code
      The code of the key event.
      Returns:
      The code of the key event
      Default:
      UNDEFINED
    • character

      String character
      The character of the key event.
      Returns:
      The character of the key event
      Default:
      "\u0000"
    • text

      String text
      The text of the key event.
      Returns:
      The text of the key event
      Default:
      ""
    • shift

      boolean shift
      Whether the shift key has to be pressed (see strict()).
      Returns:
      Whether the shift key has to be pressed
      Default:
      false
    • control

      boolean control
      Whether the control key has to be pressed (see strict()).
      Returns:
      Whether the control key has to be pressed
      Default:
      false
    • alt

      boolean alt
      Whether the alt key has to be pressed (see strict()).
      Returns:
      Whether the alt key has to be pressed
      Default:
      false
    • meta

      boolean meta
      Whether the meta key has to be pressed (see strict()). The meta key is the command key on Mac and the control key on other platforms.
      Returns:
      Whether the meta key has to be pressed
      Default:
      false
    • strict

      boolean strict
      Whether the settings for meta, control, alt and shift keys are strict.
      • When strict mode is enabled, setting any of these options to false means the key must not be pressed.
      • When strict mode is disabled, setting any of these options to false means the key does not need to be pressed.
      Returns:
      Whether the settings for meta, control, alt and shift keys are strict.
      Default:
      false
    • target

      OnKey.Target target
      The target at which the event should be handled.
      • STAGE: The event will be handled by the stage
      • SCENE: The event will be handled by the scene
      Returns:
      The target at which the event should be handled
      Default:
      STAGE
    • type

      The type of the event.
      Returns:
      The type of the event
      Default:
      PRESSED