public final class GradientRectanglePainter extends java.lang.Object implements RectanglePainter, java.io.Serializable
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.
| Constructor and Description |
|---|
GradientRectanglePainter(java.awt.Color color1,
Anchor2D anchor1,
java.awt.Color color2,
Anchor2D anchor2)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.
|
void |
fill(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
Fills the specified
area with a gradient paint created
using the colors and anchor points of this painter. |
Anchor2D |
getAnchor1()
Returns the anchor point used to find the starting point for the
gradient (as specified via the constructor).
|
Anchor2D |
getAnchor2()
Returns the anchor point used to find the ending point for the
gradient (as specified via the constructor).
|
java.awt.Color |
getColor1()
Returns the first color for the gradient (as specified via the
constructor).
|
java.awt.Color |
getColor2()
Returns the second color for the gradient (as specified via the
constructor).
|
int |
hashCode() |
public GradientRectanglePainter(java.awt.Color color1, Anchor2D anchor1, java.awt.Color color2, Anchor2D anchor2)
TitleAnchor class.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).public java.awt.Color getColor1()
null).public Anchor2D getAnchor1()
null).public java.awt.Color getColor2()
null).public Anchor2D getAnchor2()
null).public void fill(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
area with a gradient paint created
using the colors and anchor points of this painter.fill in interface RectanglePainterg2 - the graphics target (null not permitted).area - the area to fill (null not permitted).public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object (null not permitted).public int hashCode()
hashCode in class java.lang.Object