org.fest.swing.keystroke
Class KeyStrokeMap

java.lang.Object
  extended by org.fest.swing.keystroke.KeyStrokeMap

public class KeyStrokeMap
extends Object

Understands a collection of KeyStrokeMapping.

Author:
Yvonne Wang, Alex Ruiz

Method Summary
static void addKeyStrokesFrom(KeyStrokeMappingProvider provider)
          Adds the collection of KeyStrokeMappings from the given KeyStrokeMappingProvider to this map.
static char charFor(KeyStroke keyStroke)
          Given a KeyStroke, returns the equivalent character.
static void clearKeyStrokes()
          Removes all the character-KeyStroke mappings.
static boolean hasKeyStrokes()
          Indicates whether KeyStrokeMap has mappings or not.
static KeyStroke keyStrokeFor(char character)
          Returns the KeyStroke corresponding to the given character, as best we can guess it, or null if we don't know how to generate it.
static void reloadFromLocale()
          Deprecated. use reloadFromSystemSettings() instead.
static void reloadFromSystemSettings()
          Reloads the key stroke mappings for the language using the current system settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reloadFromLocale

@Deprecated
public static void reloadFromLocale()
Deprecated. use reloadFromSystemSettings() instead.

Reloads the key stroke mappings for the language from the default locale.


reloadFromSystemSettings

public static void reloadFromSystemSettings()
Reloads the key stroke mappings for the language using the current system settings.

Since:
1.2

addKeyStrokesFrom

public static void addKeyStrokesFrom(KeyStrokeMappingProvider provider)
Adds the collection of KeyStrokeMappings from the given KeyStrokeMappingProvider to this map.

Parameters:
provider - the given KeyStrokeMappingProvider.

clearKeyStrokes

public static void clearKeyStrokes()
Removes all the character-KeyStroke mappings.


hasKeyStrokes

public static boolean hasKeyStrokes()
Indicates whether KeyStrokeMap has mappings or not.

Returns:
true if it has mappings, false otherwise.

keyStrokeFor

public static KeyStroke keyStrokeFor(char character)
Returns the KeyStroke corresponding to the given character, as best we can guess it, or null if we don't know how to generate it.

Parameters:
character - the given character.
Returns:
the key code-based KeyStroke corresponding to the given character, or null if we cannot generate it.

charFor

public static char charFor(KeyStroke keyStroke)
Given a KeyStroke, returns the equivalent character. Key strokes are defined properly for US keyboards only. To contribute your own, please add them using the method addKeyStrokesFrom(KeyStrokeMappingProvider).

Parameters:
keyStroke - the given KeyStroke.
Returns:
KeyEvent.VK_UNDEFINED if the result is unknown.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.