| org.jdesktop.swingx.painter.gradient.AbstractGradientPainter org.jdesktop.swingx.painter.gradient.BasicGradientPainter
BasicGradientPainter | public class BasicGradientPainter extends AbstractGradientPainter (Code) | | A Gradient based Painter that uses GradientPaint to paint the gradient.
Simply specify the GradientPaint to use.
In order for resizing to work properly with GradientPaint
it is necessary that the various control points used in
these paints be specified in such a manner that they can be reliably resized.
For example, BasicGradientPainter takes GradientPaints who's point1 and point2
properties are specified between 0 and 1, representing at what percentage of
the distance from the origin the gradient begins and ends. Thus, if I created
a GradientPaint like this:
GradientPaint gp = new GradientPaint(
new Point2D.Double(.2d, 0),
Color.BLUE,
new Point2D.Double(.8d, 0),
Color.WHITE);
then when painted, the gradient will start with a BLUE at 20% of the width of
the component, and finish with WHITE at 80% of the width of the component.
Various built in gradients also exist as public static final properties.
They are defined as GradientPaints rather than BasicGradientPainters because
BasicGradientPainter is mutable and thus don't make very reliable public static
final defaults. To use:
panel.setBackgroundPainter(new BasicGradientPainter(BasicGradientPainter.BLUE_EXPERIENCE));
author: rbair |
Constructor Summary | |
public | BasicGradientPainter() | public | BasicGradientPainter(GradientPaint paint) | public | BasicGradientPainter(float x1, float y1, Color startColor, float x2, float y2, Color endColor) Constructs a simple acyclic BasicGradientPainter object. | public | BasicGradientPainter(Point2D startPoint, Color startColor, Point2D endPoint, Color endColor) Constructs a simple acyclic BasicGradientPainter object. | public | BasicGradientPainter(float x1, float y1, Color startColor, float x2, float y2, Color endColor, boolean cyclic) Constructs either a cyclic or acyclic BasicGradientPainter
object depending on the boolean parameter. | public | BasicGradientPainter(Point2D startPoint, Color startColor, Point2D endPoint, Color endColor, boolean cyclic) Constructs either a cyclic or acyclic BasicGradientPainter
object depending on the boolean parameter. |
BasicGradientPainter | public BasicGradientPainter()(Code) | | Creates a new instance of BasicGradientPainter
|
BasicGradientPainter | public BasicGradientPainter(GradientPaint paint)(Code) | | Creates a new instance of BasicGradientPainter
|
BasicGradientPainter | public BasicGradientPainter(float x1, float y1, Color startColor, float x2, float y2, Color endColor)(Code) | | Constructs a simple acyclic BasicGradientPainter object.
Parameters: x1 - x coordinate of the first specifiedPoint in user space Parameters: y1 - y coordinate of the first specifiedPoint in user space Parameters: startColor - Color at the first specified Point Parameters: x2 - x coordinate of the second specifiedPoint in user space Parameters: y2 - y coordinate of the second specifiedPoint in user space Parameters: endColor - Color at the second specified Point throws: NullPointerException - if either one of colors is null |
BasicGradientPainter | public BasicGradientPainter(Point2D startPoint, Color startColor, Point2D endPoint, Color endColor)(Code) | | Constructs a simple acyclic BasicGradientPainter object.
Parameters: startPoint - the first specified Point in user space Parameters: startColor - Color at the first specified Point Parameters: endPoint - the second specified Point in user space Parameters: endColor - Color at the second specified Point throws: NullPointerException - if either one of colors or points is null |
BasicGradientPainter | public BasicGradientPainter(float x1, float y1, Color startColor, float x2, float y2, Color endColor, boolean cyclic)(Code) | | Constructs either a cyclic or acyclic BasicGradientPainter
object depending on the boolean parameter.
Parameters: x1 - x coordinate of the first specifiedPoint in user space Parameters: y1 - y coordinate of the first specifiedPoint in user space Parameters: startColor - Color at the first specified Point Parameters: x2 - x coordinate of the second specifiedPoint in user space Parameters: y2 - y coordinate of the second specifiedPoint in user space Parameters: endColor - Color at the second specified Point Parameters: cyclic - true if the gradient pattern should cyclerepeatedly between the two colors; false otherwise |
BasicGradientPainter | public BasicGradientPainter(Point2D startPoint, Color startColor, Point2D endPoint, Color endColor, boolean cyclic)(Code) | | Constructs either a cyclic or acyclic BasicGradientPainter
object depending on the boolean parameter.
Parameters: startPoint - the first specified Point in user space Parameters: startColor - Color at the first specified Point Parameters: endPoint - the second specified Point in user space Parameters: endColor - Color at the second specified Point Parameters: cyclic - true if the gradient pattern should cyclerepeatedly between the two colors; false otherwise throws: NullPointerException - if either one of colors or points is null |
calculateSizedPaint | protected Paint calculateSizedPaint(int width, int height)(Code) | | |
getGradientPaint | public GradientPaint getGradientPaint()(Code) | | the GradientPaint used for painting. This may be null |
setGradientPaint | public void setGradientPaint(GradientPaint paint)(Code) | | Set the gradient paint to use. This may be null. If null, nothing is painted
Parameters: paint - the GradientPaint to use |
|
|