java.lang.Object
org.gjt.sp.jedit.gui.KeyEventTranslator
In conjunction with the
KeyEventWorkaround, hides some
warts in the AWT key event API.- Version:
- $Id: KeyEventTranslator.java 24859 2018-04-10 23:06:33Z daleanson $
- Author:
- Slava Pestov
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a keyboard translation.static StringReturns a string containing symbolic modifier names set in the specified event.static chargetSymbolicModifierName(int mod) Returns a the symbolic modifier name for the specified Java modifier flag.static StringmodifiersToString(int mods) static KeyEventTranslator.KeyConverts a string to a keystroke.static KeyStrokeparseKeyStroke(String shortcut) Converts a string to a Swing KeyStroke.static voidsetModifierMapping(int c, int a, int m, int s) Changes the mapping between symbolic modifier key names (C,A,M,S) and Java modifier flags.static KeyEventTranslator.KeyPass this an event fromKeyEventWorkaround.processKeyEvent(java.awt.event.KeyEvent).
-
Field Details
-
lastKeyPressEvent
-
lastKeyPressAccepted
protected static boolean lastKeyPressAccepted
-
-
Constructor Details
-
KeyEventTranslator
public KeyEventTranslator()
-
-
Method Details
-
addTranslation
Adds a keyboard translation.- Parameters:
key1- Translate this keykey2- Into this key- Since:
- jEdit 4.2pre3
-
translateKeyEvent
Pass this an event fromKeyEventWorkaround.processKeyEvent(java.awt.event.KeyEvent).- Parameters:
evt- the KeyEvent to translate- Since:
- jEdit 4.2pre3
-
parseKey
Converts a string to a keystroke. The string should be of the form modifiers+shortcut where modifiers is any combination of A for Alt, C for Control, S for Shift or M for Meta, and shortcut is either a single character, or a keycode name from theKeyEventclass, without theVK_prefix.- Parameters:
keyStroke- A string description of the key stroke- Since:
- jEdit 4.2pre3
-
parseKeyStroke
Converts a string to a Swing KeyStroke. The string should be of the form modifiers+shortcut where modifiers is any combination of A for Alt, C for Control, S for Shift or M for Meta, and shortcut is either a single character, or a keycode name from theKeyEventclass, without theVK_prefix. Returns null if the string corresponds to multiple KeyStrokes (e.g., "C+e C+COMMA").- Parameters:
shortcut- A string description of the key stroke- Since:
- jEdit 5.0
-
setModifierMapping
public static void setModifierMapping(int c, int a, int m, int s) Changes the mapping between symbolic modifier key names (C,A,M,S) and Java modifier flags. You can map more than one Java modifier to a symobolic modifier, for example :
You cannot map a Java modifer to more than one symbolic modifier.setModifierMapping( InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK, 0, InputEvent.SHIFT_MASK);- Parameters:
c- The modifier(s) to map theCmodifier toa- The modifier(s) to map theAmodifier tom- The modifier(s) to map theMmodifier tos- The modifier(s) to map theSmodifier to- Since:
- jEdit 4.2pre3
-
getSymbolicModifierName
public static char getSymbolicModifierName(int mod) Returns a the symbolic modifier name for the specified Java modifier flag.- Parameters:
mod- A modifier constant fromInputEvent- Since:
- jEdit 4.2pre3
-
modifiersToString
-
getModifierString
Returns a string containing symbolic modifier names set in the specified event.- Parameters:
evt- The event- Since:
- jEdit 4.2pre3
-