Class GradientRectanglePainter

java.lang.Object
org.jfree.chart3d.table.GradientRectanglePainter
All Implemented Interfaces:
Serializable, RectanglePainter

public final class GradientRectanglePainter extends Object implements RectanglePainter, Serializable
A RectanglePainter that can fill a rectangle with a gradient (the gradient is generated using anchor points to fit any size rectangle on demand). Instances of this class are immutable.

NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
See Also:
  • Constructor Details

    • GradientRectanglePainter

      public GradientRectanglePainter(Color color1, Anchor2D anchor1, Color color2, Anchor2D anchor2)
      Creates a new instance.

      NOTE: some useful standard anchor points are defined in the TitleAnchor class.
      Parameters:
      color1 - the first color for the gradient (null not permitted).
      anchor1 - the anchor point used to determine the starting point for the gradient (null not permitted).
      color2 - the second color for the gradient (null not permitted).
      anchor2 - the anchor point used to determine the ending point for the gradient (null not permitted).
  • Method Details

    • getColor1

      public Color getColor1()
      Returns the first color for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
      The first color for the gradient (never null).
    • getAnchor1

      public Anchor2D getAnchor1()
      Returns the anchor point used to find the starting point for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
      The anchor point (never null).
    • getColor2

      public Color getColor2()
      Returns the second color for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
      The second color for the gradient (never null).
    • getAnchor2

      public Anchor2D getAnchor2()
      Returns the anchor point used to find the ending point for the gradient (as specified via the constructor). There is no setter method because instances of this class are immutable.
      Returns:
      The anchor point (never null).
    • fill

      public void fill(Graphics2D g2, Rectangle2D area)
      Fills the specified area with a gradient paint created using the colors and anchor points of this painter.
      Specified by:
      fill in interface RectanglePainter
      Parameters:
      g2 - the graphics target (null not permitted).
      area - the area to fill (null not permitted).
    • equals

      public boolean equals(Object obj)
      Tests this instance for equality with an arbitrary object.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object (null not permitted).
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object