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 BLACK
The black color (0,0,0).BLUE
The blue colorCYAN
The cyan (light blue) colorDARK_GRAY
The dark gray colorGRAY
The White colorGREEN
The green colorLIGHT_GRAY
The light gray colorMAGENTA
The magenta colorRED
The red colorWHITE
The white color (255,255,255).YELLOW
The yellow color -
Method Summary
Modifier and Type Method Description static CommonColors
fromLabel(java.lang.String label)
Determines the operation type from its label.static java.lang.String[]
getAllLabels()
java.awt.Color
getColor()
java.lang.String
getLabel()
java.lang.String
toString()
static CommonColors
valueOf(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, valueOf
Methods 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:
toString
in 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.
-