Package org.eclipse.gef
Class KeyStroke
- java.lang.Object
-
- org.eclipse.gef.KeyStroke
-
public class KeyStroke extends java.lang.Object
Encapsulates a Keyboard gesture (press or release) from the User. A KeyStroke is matched to a KeyEvent based theKeyEvent.stateMask
,KeyEvent.keyCode
orKeyEvent.character
, and whether that KeyEvent was dispatched as a result of a release or press by the User.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
static KeyStroke
getPressed(char character, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.character
andKeyEvent.stateMask
during a press event.static KeyStroke
getPressed(char character, int keyCode, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.character
,KeyEvent.keyCode
, andKeyEvent.stateMask
during a press event.static KeyStroke
getPressed(int keyCode, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.keyCode
andKeyEvent.stateMask
during a press event.static KeyStroke
getReleased(char character, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.character
andKeyEvent.stateMask
during a release event.static KeyStroke
getReleased(char character, int keyCode, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.character
,KeyEvent.keyCode
, andKeyEvent.stateMask
during a release event.static KeyStroke
getReleased(int keyCode, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.keyCode
andKeyEvent.stateMask
during a release event.int
hashCode()
-
-
-
Method Detail
-
getPressed
public static KeyStroke getPressed(char character, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.character
andKeyEvent.stateMask
during a press event.- Parameters:
character
- the character to matchstateMask
- the stateMask to match- Returns:
- a new KeyStroke
-
getPressed
public static KeyStroke getPressed(int keyCode, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.keyCode
andKeyEvent.stateMask
during a press event.- Parameters:
keyCode
- the keyCode to matchstateMask
- 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 givenKeyEvent.character
,KeyEvent.keyCode
, andKeyEvent.stateMask
during a press event.- Parameters:
character
- the character to matchkeyCode
- the keyCode to matchstateMask
- the stateMask to match- Returns:
- a new KeyStroke
-
getReleased
public static KeyStroke getReleased(char character, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.character
andKeyEvent.stateMask
during a release event.- Parameters:
character
- the character to matchstateMask
- the stateMask to match- Returns:
- a new KeyStroke
-
getReleased
public static KeyStroke getReleased(int keyCode, int stateMask)
Constructs a KeyStroke that will match the givenKeyEvent.keyCode
andKeyEvent.stateMask
during a release event.- Parameters:
keyCode
- the keyCode to matchstateMask
- 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 givenKeyEvent.character
,KeyEvent.keyCode
, andKeyEvent.stateMask
during a release event.- Parameters:
character
- the character to matchkeyCode
- the keyCode to matchstateMask
- the stateMask to match- Returns:
- a new KeyStroke
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the Object being compared- Returns:
- true iff the Object is an equivalent KeyStroke
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-