Class KeyStrokeMap

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

public class KeyStrokeMap extends Object
Understands a collection of KeyStrokeMapping.
  • Field Details

  • Constructor Details

    • KeyStrokeMap

      private KeyStrokeMap()
  • Method Details

    • reloadFromLocale

      @Deprecated public static void reloadFromLocale()
      Deprecated.
      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
    • updateKeyStrokeMapCollection

      static void updateKeyStrokeMapCollection(KeyStrokeMapCollection c)
    • addKeyStrokesFrom

      public static void addKeyStrokesFrom(KeyStrokeMappingProvider provider)
      Adds the collection of KeyStrokeMappings from the given KeyStrokeMappingProvider to this map.
      Parameters:
      provider - the given KeyStrokeMappingProvider.
    • add

      private static void add(Character character, KeyStroke keyStroke)
    • 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.
    • charWithoutModifiersButShift

      private static Character charWithoutModifiersButShift(KeyStroke keyStroke)