public class ShortcutEvent extends EventObject implements Serializable
source
Constructor and Description |
---|
ShortcutEvent(Component source,
Component lifecycleOwner,
Key key,
Set<KeyModifier> keyModifiers)
Creates a new
ShortcutEvent . |
Modifier and Type | Method and Description |
---|---|
Key |
getKey()
Primary
Key that triggered the shortcut. |
Set<KeyModifier> |
getKeyModifiers()
Set of
KeyModifiers that, in combination with the
primary key, triggered the shortcut. |
Component |
getLifecycleOwner()
Component which owns the shortcut.
|
Component |
getSource()
Component which listened for the shortcut.
|
boolean |
matches(Key key,
KeyModifier... keyModifiers)
Checks if the event matches the given
Key and (optional)
KeyModifiers . |
toString
public ShortcutEvent(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers)
ShortcutEvent
.source
- shortcut's listenOn
Component
lifecycleOwner
- shortcut's lifecycleOwner
Component
key
- primary Key
of the shortcutkeyModifiers
- set of KeyModifiers
of the shortcutpublic Component getSource()
getSource
in class EventObject
Component
public Component getLifecycleOwner()
Component
public Key getKey()
Key
that triggered the shortcut. Primary key can be
anything that is not a KeyModifier
.public Set<KeyModifier> getKeyModifiers()
KeyModifiers
that, in combination with the
primary key, triggered the shortcut.public boolean matches(Key key, KeyModifier... keyModifiers)
Key
and (optional)
KeyModifiers
. If key
is null or a wrong
number of keyModifiers
is given, returns false
.key
- key
to comparekeyModifiers
- keyModifiers
to compareCopyright © 2019. All rights reserved.