Class Modifiers

java.lang.Object
org.fest.swing.util.Modifiers

public final class Modifiers extends Object
Understands utility methods related to input modifiers. This class also maps modifier masks to key codes for the following modifiers:
  • Alt
  • AltGraph
  • Control
  • Meta
  • Shift
  • Field Details

  • Constructor Details

    • Modifiers

      private Modifiers()
  • Method Details

    • keysFor

      public static int[] keysFor(int modifierMask)
      Returns the key codes for the given modifier mask.
      Parameters:
      modifierMask - the given modifier mask.
      Returns:
      the key codes for the given modifier mask.
    • isModifier

      public static boolean isModifier(int keyCode)
      Indicates whether the given key code is a modifier.
      Parameters:
      keyCode - the given key code.
      Returns:
      true if the given key code is a modifier, false otherwise.
    • maskFor

      public static int maskFor(int keyCode)
      Returns the modifier mask for the given key code.
      Parameters:
      keyCode - the given key code.
      Returns:
      the modifier mask for the given key code.
      Throws:
      IllegalArgumentException - if the given key code is not a modifier.
    • updateModifierWithKeyCode

      public static int updateModifierWithKeyCode(int keyCode, int modifierMask)
      Updates the given modifier mask with the given key code, only if the given key code belongs to a modifier key.
      Parameters:
      keyCode - the given key code.
      modifierMask - the given modifier mask.
      Returns:
      the updated modifier mask.