Class Color


  • public class Color
    extends java.lang.Object
    Represents a color as an RGB value.
    • Constructor Summary

      Constructors 
      Constructor Description
      Color​(int r, int g, int b)
      Creates a Color object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int B()
      Returns the blue component of this Color.
      static Color fromString​(java.lang.String text)
      Creates a Color object from a string in the form "r,g,b"
      int G()
      Returns the green component of this Color.
      int R()
      Returns the red component of this Color.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Color

        public Color​(int r,
                     int g,
                     int b)
        Creates a Color object.
        Parameters:
        r - red
        g - green
        b - blue
    • Method Detail

      • fromString

        public static Color fromString​(java.lang.String text)
        Creates a Color object from a string in the form "r,g,b"
        Parameters:
        text - the text to parse
        Returns:
        a Color object
      • R

        public int R()
        Returns the red component of this Color.
        Returns:
        the red component
      • G

        public int G()
        Returns the green component of this Color.
        Returns:
        the green component
      • B

        public int B()
        Returns the blue component of this Color.
        Returns:
        the blue component
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object