Class ShortcutEvent

    • Constructor Detail

      • ShortcutEvent

        public ShortcutEvent​(Component source,
                             Component lifecycleOwner,
                             Key key,
                             Set<KeyModifier> keyModifiers)
        Creates a new ShortcutEvent.
        Parameters:
        source - shortcut's listenOn Component
        lifecycleOwner - shortcut's lifecycleOwner Component
        key - primary Key of the shortcut
        keyModifiers - set of KeyModifiers of the shortcut
    • Method Detail

      • getLifecycleOwner

        public Component getLifecycleOwner()
        Component which owns the shortcut.
        Returns:
        owning Component
      • getKey

        public Key getKey()
        Primary Key that triggered the shortcut. Primary key can be anything that is not a KeyModifier.
        Returns:
        primary key
      • getKeyModifiers

        public Set<KeyModifier> getKeyModifiers()
        Set of KeyModifiers that, in combination with the primary key, triggered the shortcut.
        Returns:
        set of key modifiers
      • matches

        public boolean matches​(Key key,
                               KeyModifier... keyModifiers)
        Checks if the event matches the given Key and (optional) KeyModifiers. If key is null or a wrong number of keyModifiers is given, returns false.
        Parameters:
        key - key to compare
        keyModifiers - keyModifiers to compare
        Returns:
        Did the given parameters match those in the event?