Enum Modifiers
- java.lang.Object
-
- java.lang.Enum<Modifiers>
-
- net.sf.jguiraffe.gui.builder.event.Modifiers
-
- All Implemented Interfaces:
Serializable,Comparable<Modifiers>
public enum Modifiers extends Enum<Modifiers>
An enumeration class representing special modifier keys.
A typical key board contains some special modifier keys that can be pressed together with other keys modifying their state and meaning, e.g. the SHIFT or the ALT key. This class defines constants for such keys. Most UI toolkits define similar constants. This enumeration class provides a portable way of specifying such modifiers.
The constants defined by this class can be used by several other classes in the JGUIraffe library. For instance, accelerators for actions (i.e. key board short cuts) may be assigned some modifiers that need to be pressed for activating the accelerator. When a mouse event is received, it is also possible to query the status of the modifier keys.
Tip: When working with modifiers often sets are needed because other objects (e.g. accelerators) can be associated with an arbitrary number of modifiers. In such cases the
java.util.EnumSetclass can be used. It provides convenience methods for creating sets containing specific combinations ofModifiersconstants. The following code fragment demonstrates how such a set can be obtained:EnumSet<Modifiers> mods = EnumSet.of(Modifiers.ALT, Modifiers.SHIFT);
- Version:
- $Id: Modifiers.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALTConstant representing the ALT modifier key.ALT_GRAPHConstant representing the ALT GRAPH modifier key.CONTROLConstant representing the CONTROL modifier key.METAConstant representing the META modifier key.SHIFTConstant representing the SHIFT modifier key.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ModifiersfromString(String s)Tries to find aModifiersconstant for the specified string.static ModifiersvalueOf(String name)Returns the enum constant of this type with the specified name.static Modifiers[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ALT
public static final Modifiers ALT
Constant representing the ALT modifier key.
-
ALT_GRAPH
public static final Modifiers ALT_GRAPH
Constant representing the ALT GRAPH modifier key.
-
CONTROL
public static final Modifiers CONTROL
Constant representing the CONTROL modifier key.
-
META
public static final Modifiers META
Constant representing the META modifier key.
-
SHIFT
public static final Modifiers SHIFT
Constant representing the SHIFT modifier key.
-
-
Method Detail
-
values
public static Modifiers[] 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 (Modifiers c : Modifiers.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Modifiers valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
fromString
public static Modifiers fromString(String s)
Tries to find aModifiersconstant for the specified string. The string is compared with the constants defined in this class ignoring case. If a match is found, the correspondingModifiersconstant is returned. Otherwise, an exception is thrown.- Parameters:
s- the string to be parsed- Returns:
- the corresponding
Modifiersconstant - Throws:
IllegalArgumentException- if no match can be found
-
-