Package inra.ijpb.color
Enum CommonColors
java.lang.Object
java.lang.Enum<CommonColors>
inra.ijpb.color.CommonColors
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CommonColors>,java.lang.constant.Constable
public enum CommonColors extends java.lang.Enum<CommonColors>
A collection of common colors used for creating overlays, choosing background color...
Example:
// Use a generic dialog to choose a color
GenericDialog gd = new GenericDialog();
gd.addChoice("Color", CommonColors.getAllLabels());
gd.showDialog();
// extract the color from the name
String colorName = gd.getNextChoice();
Color color = CommonColors.fromLabel(colorName).getColor();
- Author:
- dlegland
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>> -
Enum Constant Summary
Enum Constants Enum Constant Description BLACKThe black color (0,0,0).BLUEThe blue colorCYANThe cyan (light blue) colorDARK_GRAYThe dark gray colorGRAYThe White colorGREENThe green colorLIGHT_GRAYThe light gray colorMAGENTAThe magenta colorREDThe red colorWHITEThe white color (255,255,255).YELLOWThe yellow color -
Method Summary
Modifier and Type Method Description static CommonColorsfromLabel(java.lang.String label)Determines the operation type from its label.static java.lang.String[]getAllLabels()java.awt.ColorgetColor()java.lang.StringgetLabel()java.lang.StringtoString()static CommonColorsvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static CommonColors[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, valueOfMethods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Enum Constant Details
-
WHITE
The white color (255,255,255). -
BLACK
The black color (0,0,0). -
RED
The red color -
GREEN
The green color -
BLUE
The blue color -
CYAN
The cyan (light blue) color -
MAGENTA
The magenta color -
YELLOW
The yellow color -
GRAY
The White color -
DARK_GRAY
The dark gray color -
LIGHT_GRAY
The light gray color
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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 namejava.lang.NullPointerException- if the argument is null
-
getLabel
public java.lang.String getLabel()- Returns:
- the label associated to this enumeration item
-
getColor
public java.awt.Color getColor()- Returns:
- the java color corresponding to this enumeration item
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Enum<CommonColors>- Returns:
- a string representation of this enumeration item
-
getAllLabels
public static java.lang.String[] getAllLabels()- Returns:
- the array of labels for the colors within this enumeration
-
fromLabel
Determines the operation type from its label.- Parameters:
label- the name of the color- Returns:
- the Colors enumeration corresponding to the name
- Throws:
java.lang.IllegalArgumentException- if color name is not recognized.
-