Paint (JavaFX 25)
Description: declaration: module: javafx.graphics, package: javafx.scene.paint, class: Paint

# Class Paint

java.lang.Object
javafx.scene.paint.Paint

All Implemented Interfaces:
  `Interpolatable<Paint>`

Direct Known Subclasses:
  `Color, ImagePattern, LinearGradient, RadialGradient`

public abstract sealed class Paint extends Object implements Interpolatable<Paint> permits Color, LinearGradient, RadialGradient, ImagePattern
Base class for a color or gradients used to fill shapes and backgrounds when rendering the scene graph.

Linear interpolation is supported between the following heterogeneous paint combinations:

- `Color` ↔ `LinearGradient`
- `Color` ↔ `RadialGradient`

Heterogeneous paint interpolation converts the `Color` to a visually identical gradient paint, and then performs a linear interpolation between the two gradient paints. If heterogeneous paints cannot be interpolated as described, the paints are interpolated as discrete.

Since:
  JavaFX 2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract boolean`
  `isOpaque()`
  Gets whether this Paint is completely opaque.
  `static Paint`
  `valueOf(String value)`
  Creates a paint value from a string representation.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods declared in interface Interpolatable

  `interpolate`

- ## Method Details

  - ### isOpaque

    public abstract boolean isOpaque()
    Gets whether this Paint is completely opaque. An opaque paint is one that has no alpha component in any of its colors. It may be possible for a Paint to be opaque and yet return false, if it cannot be easily determined whether the paint is actually opaque. For example, the ImagePattern may not be able to cheaply determine its opacity.
    Returns:
      true if the Paint is opaque, false if it is not opaque or if it cannot be determined.
    Since:
      JavaFX 8.0

  - ### valueOf

    public static Paint valueOf(String value)
    Creates a paint value from a string representation. Recognizes strings representing `Color`, `RadialGradient` or `LinearGradient`. String specifying LinearGradient must begin with linear-gradient keyword and string specifying RadialGradient must begin with radial-gradient.
    Parameters:
      `value` - the string to convert
    Returns:
      a `Color`, `RadialGradient` or `LinearGradient` object holding the value represented by the string argument.
    Throws:
      `NullPointerException` - if `value` is `null`
      `IllegalArgumentException` - if `value` cannot be parsed
    Since:
      JavaFX 2.1
    See Also:
      - `Color.valueOf(String)`
      - `LinearGradient.valueOf(String)`
      - `RadialGradient.valueOf(String)`