Class RGBColorBean


public class RGBColorBean extends AnchorBean<RGBColorBean>
A bean describing a color in the RGB color space.
Author:
Owen Feehan
  • Constructor Details

    • RGBColorBean

      public RGBColorBean()
      Creates with a completely black color.

      i.e. Red, green, blue values are assigned 0

    • RGBColorBean

      public RGBColorBean(RGBColor color)
      Create from a RGBColor.
      Parameters:
      color - the color, which continues to be used internally after the constructor call.
    • RGBColorBean

      public RGBColorBean(Color color)
      Create from a Color.
      Parameters:
      color - the color, which is no longer used internally after the constructor call.
    • RGBColorBean

      public RGBColorBean(int red, int green, int blue)
      Create from values for red, green and blue.
      Parameters:
      red - the value for the red color component.
      green - the value for the green color component.
      blue - the value for the blue color component.
  • Method Details

    • getRed

      public int getRed()
      The red component value of the RGB color.
      Returns:
      a value between 0 and 255 (inclusive)
    • getGreen

      public int getGreen()
      The green component value of the RGB color.
      Returns:
      a value between 0 and 255 (inclusive)
    • getBlue

      public int getBlue()
      The blue component value of the RGB color.
      Returns:
      a value between 0 and 255 (inclusive)
    • setRed

      public void setRed(int value)
      Sets the red component value.
      Parameters:
      value - the value to assign
    • setGreen

      public void setGreen(int value)
      Sets the green component value.
      Parameters:
      value - the value to assign
    • setBlue

      public void setBlue(int value)
      Sets the blue component value.
      Parameters:
      value - the value to assign
    • getRGB

      public int getRGB()
      Returns the RGB value encoded as an int as in Color.getRGB().
      Returns:
      the rgb value encoded as an int.
    • toRGBColor

      public RGBColor toRGBColor()
      The RGBColor associated with the bean.
      Returns:
      the color, as used internally.
    • toAWTColor

      public Color toAWTColor()
      Converts to a Color representation.
      Returns:
      the color, as used internally.
    • duplicateBean

      public RGBColorBean duplicateBean()
      Description copied from class: AnchorBean
      Creates a new bean that deep-copies every property value.

      Any state that is not a BeanField is ignored.

      Overrides:
      duplicateBean in class AnchorBean<RGBColorBean>
      Returns:
      the newly created bean