Class KeyStroke

java.lang.Object
org.eclipse.gef.KeyStroke

public class KeyStroke extends Object
Encapsulates a Keyboard gesture (press or release) from the User. A KeyStroke is matched to a KeyEvent based the KeyEvent.stateMask, KeyEvent.keyCode or KeyEvent.character, and whether that KeyEvent was dispatched as a result of a release or press by the User.
  • Method Details

    • getPressed

      public static KeyStroke getPressed(char character, int stateMask)
      Constructs a KeyStroke that will match the given KeyEvent.character and KeyEvent.stateMask during a press event.
      Parameters:
      character - the character to match
      stateMask - the stateMask to match
      Returns:
      a new KeyStroke
    • getPressed

      public static KeyStroke getPressed(int keyCode, int stateMask)
      Constructs a KeyStroke that will match the given KeyEvent.keyCode and KeyEvent.stateMask during a press event.
      Parameters:
      keyCode - the keyCode to match
      stateMask - the stateMask to match
      Returns:
      a new KeyStroke
    • getPressed

      public static KeyStroke getPressed(char character, int keyCode, int stateMask)
      Constructs a KeyStroke that will match the given KeyEvent.character, KeyEvent.keyCode, and KeyEvent.stateMask during a press event.
      Parameters:
      character - the character to match
      keyCode - the keyCode to match
      stateMask - the stateMask to match
      Returns:
      a new KeyStroke
    • getReleased

      public static KeyStroke getReleased(char character, int stateMask)
      Constructs a KeyStroke that will match the given KeyEvent.character and KeyEvent.stateMask during a release event.
      Parameters:
      character - the character to match
      stateMask - the stateMask to match
      Returns:
      a new KeyStroke
    • getReleased

      public static KeyStroke getReleased(int keyCode, int stateMask)
      Constructs a KeyStroke that will match the given KeyEvent.keyCode and KeyEvent.stateMask during a release event.
      Parameters:
      keyCode - the keyCode to match
      stateMask - the stateMask to match
      Returns:
      a new KeyStroke
    • getReleased

      public static KeyStroke getReleased(char character, int keyCode, int stateMask)
      Constructs a KeyStroke that will match the given KeyEvent.character, KeyEvent.keyCode, and KeyEvent.stateMask during a release event.
      Parameters:
      character - the character to match
      keyCode - the keyCode to match
      stateMask - the stateMask to match
      Returns:
      a new KeyStroke
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      Parameters:
      obj - the Object being compared
      Returns:
      true iff the Object is an equivalent KeyStroke
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also: