Enum Keyboard.Modifier

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Keyboard.Modifier>
    Enclosing class:
    Keyboard

    public static enum Keyboard.Modifier
    extends java.lang.Enum<Keyboard.Modifier>
    Enumeration representing keyboard modifiers.
    • Method Detail

      • values

        public static Keyboard.Modifier[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Keyboard.Modifier c : Keyboard.Modifier.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Keyboard.Modifier valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getMask

        public int getMask()
        Returns:
        The one-bit mask for this modifier, which is 2**ordinal.
      • getMask

        public static int getMask​(Set<Keyboard.Modifier> modifiers)
        Determine the complete mask for all the given modifiers.
        Parameters:
        modifiers - The set of modifiers to test.
        Returns:
        The complete mask corresponding to the set.
      • getMask

        public static int getMask​(Keyboard.Modifier... modifiers)
        Determine the complete mask for all the given modifiers.
        Parameters:
        modifiers - The list of modifiers to test.
        Returns:
        The complete mask corresponding to the list.
      • getAWTMask

        public static int getAWTMask​(int mask)
        Determine the complete set of AWT modifiers for a set of mask values.
        Parameters:
        mask - The complete mask set of our modifiers.
        Returns:
        The complete mask for AWT use.
      • getModifiers

        public static int getModifiers​(int awtModifiers,
                                       int keyLocation)
        Determine the complete set of our modifier masks that are represented by the given AWT modifiers set.
        Parameters:
        awtModifiers - The set of modifiers returned by InputEvent.getModifiersEx().
        keyLocation - Where the key event originated (used to modify/ignore some modifiers).
        Returns:
        The complete mask of the our modifiers represented by the input.
      • decode

        public static Keyboard.Modifier decode​(java.lang.String input)
        Convert the input string into one of our enum values.
        Parameters:
        input - Should be one of the enum constants, but we will also recognize the constant regardless of case, and also allow the Unicode character equivalent to be valid.
        Returns:
        The enum value corresponding to the input.
        Throws:
        java.lang.IllegalArgumentException - if the input cannot be recognized
        java.lang.NullPointerException - if the input value is null