Package org.eclipse.gef

# 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 Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`static KeyStroke`
`getPressed(char character, int stateMask)`
Constructs a KeyStroke that will match the given `KeyEvent.character` and `KeyEvent.stateMask` during a press event.
`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.
`static KeyStroke`
`getPressed(int keyCode, int stateMask)`
Constructs a KeyStroke that will match the given `KeyEvent.keyCode` and `KeyEvent.stateMask` during a press event.
`static KeyStroke`
`getReleased(char character, int stateMask)`
Constructs a KeyStroke that will match the given `KeyEvent.character` and `KeyEvent.stateMask` during a release event.
`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.
`static KeyStroke`
`getReleased(int keyCode, int stateMask)`
Constructs a KeyStroke that will match the given `KeyEvent.keyCode` and `KeyEvent.stateMask` during a release event.
`int`
`hashCode()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## 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:
  - `Object.hashCode()`