Class Color.Builder

java.lang.Object
com.teamdev.jxbrowser.ui.Color.Builder
Enclosing interface:
Color

public static final class Color.Builder extends Object
A builder of Color.

Builders are created by invoking Color.newBuilder(). Each of the setter methods modifies the state of the builder and returns the same instance. Builders are not thread-safe and should not be used concurrently from multiple threads without external synchronization.

  • Method Details

    • red

      public Color.Builder red(float red)
      Sets the red channel value in the 0..1 range.
      Parameters:
      red - the red channel value
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when the red is out of the 0..1 range
    • green

      public Color.Builder green(float green)
      Sets the green channel value in the 0..1 range.
      Parameters:
      green - the green channel value
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when the green is out of the 0..1 range
    • blue

      public Color.Builder blue(float blue)
      Sets the blue channel value in the 0..1 range.
      Parameters:
      blue - the blue channel value
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when the blue is out of the 0..1 range
    • alpha

      public Color.Builder alpha(float alpha)
      Sets the alpha channel value in the 0..1 range.
      Parameters:
      alpha - the alpha channel value
      Returns:
      this builder
      Throws:
      IllegalArgumentException - when the alpha is out of the 0..1 range
    • build

      public Color build()
      Returns a new Color instance built from the current state of this builder.
      Returns:
      a new Color instance