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 color
    CYAN
    The cyan (light blue) color
    DARK_GRAY
    The dark gray color
    GRAY
    The White color
    GREEN
    The green color
    LIGHT_GRAY
    The light gray color
    MAGENTA
    The magenta color
    RED
    The red color
    WHITE
    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

      public static final CommonColors WHITE
      The white color (255,255,255).
    • BLACK

      public static final CommonColors BLACK
      The black color (0,0,0).
    • RED

      public static final CommonColors RED
      The red color
    • GREEN

      public static final CommonColors GREEN
      The green color
    • BLUE

      public static final CommonColors BLUE
      The blue color
    • CYAN

      public static final CommonColors CYAN
      The cyan (light blue) color
    • MAGENTA

      public static final CommonColors MAGENTA
      The magenta color
    • YELLOW

      public static final CommonColors YELLOW
      The yellow color
    • GRAY

      public static final CommonColors GRAY
      The White color
    • DARK_GRAY

      public static final CommonColors DARK_GRAY
      The dark gray color
    • LIGHT_GRAY

      public static final CommonColors LIGHT_GRAY
      The light gray color
  • Method Details

    • values

      public static CommonColors[] 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

      public static CommonColors 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
    • 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 class java.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

      public static CommonColors fromLabel​(java.lang.String label)
      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.