Class Keybind

  • Direct Known Subclasses:
    ModifierlessKeybind

    public class Keybind
    extends java.lang.Object
    A combination of zero or more modifier keys (Ctrl, alt, shift, meta) and an optional non-modifier key
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Keybind​(int keyCode, int modifiers)  
      protected Keybind​(int keyCode, int modifiers, boolean ignoreModifiers)  
        Keybind​(java.awt.event.KeyEvent e)
      Constructs a keybind with that matches the passed KeyEvent
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canEqual​(java.lang.Object other)  
      boolean equals​(java.lang.Object o)  
      int getKeyCode()  
      static java.lang.Integer getModifierForKeyCode​(int keyCode)  
      int getModifiers()  
      int hashCode()  
      boolean matches​(java.awt.event.KeyEvent e)
      If the KeyEvent is from a KeyPressed event this returns if the Event is this hotkey being pressed.
      protected boolean matches​(java.awt.event.KeyEvent e, boolean ignoreModifiers)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NOT_SET

        public static final Keybind NOT_SET
      • CTRL

        public static final Keybind CTRL
      • ALT

        public static final Keybind ALT
      • SHIFT

        public static final Keybind SHIFT
    • Constructor Detail

      • Keybind

        protected Keybind​(int keyCode,
                          int modifiers,
                          boolean ignoreModifiers)
      • Keybind

        public Keybind​(int keyCode,
                       int modifiers)
      • Keybind

        public Keybind​(java.awt.event.KeyEvent e)
        Constructs a keybind with that matches the passed KeyEvent
    • Method Detail

      • matches

        public boolean matches​(java.awt.event.KeyEvent e)
        If the KeyEvent is from a KeyPressed event this returns if the Event is this hotkey being pressed. If the KeyEvent is a KeyReleased event this returns if the event is this hotkey being released
      • matches

        protected boolean matches​(java.awt.event.KeyEvent e,
                                  boolean ignoreModifiers)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getModifierForKeyCode

        @Nullable
        public static java.lang.Integer getModifierForKeyCode​(int keyCode)
      • getKeyCode

        public int getKeyCode()
      • getModifiers

        public int getModifiers()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object