Class LinearGradientPaint
- All Implemented Interfaces:
Paint
Shape with a linear gradient.-
Nested Class Summary
Nested classes/interfaces inherited from class MultipleGradientPaint
MultipleGradientPaint.ColorSpaceType, MultipleGradientPaint.CycleMethodModifier and TypeClassDescriptionstatic enumColors spaces for gradients.static enumCycle methods for gradients. -
Constructor Summary
ConstructorsConstructorDescriptionLinearGradientPaint(double startX, double startY, double endX, double endY, float[] fractions, int[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, Transform gradientTransform) Creates a LinearGradientPaint with the specified settings.LinearGradientPaint(float startX, float startY, float endX, float endY, float[] fractions, int[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, Transform gradientTransform) Creates a LinearGradientPaint with the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidPainds the linear gradient in the given bounds.final voidpaint(Graphics g, Rectangle2D bounds) Paints linear gradient in the given bounds.Methods inherited from class MultipleGradientPaint
getColors, getColorSpace, getCycleMethod, getFractions, getTransform, getTransparency, setColors, setColorSpace, setCycleMethod, setFractions, setTransform, setTransparencyModifier and TypeMethodDescriptionint[]Gets the colors used in the gradient.Gets the color space for the gradient.Gets the cycle method.float[]Gets the fractional positions for the color gradients.Gets the gradient transform.intGets the transparency for the gradient.voidsetColors(int[] colors) Sets the colors used in the gradient.voidsetColorSpace(MultipleGradientPaint.ColorSpaceType colorSpaceType) Sets the color space for the gradient.voidsetCycleMethod(MultipleGradientPaint.CycleMethod cycleMethod) Sets the cycle method.voidsetFractions(float[] fractions) Sets the fractional positions of the color gradients.voidsetTransform(Transform transform) Sets the transform for the gradient.voidsetTransparency(int transparency) Sets the transparency for the gradient.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Constructor Details
-
LinearGradientPaint
public LinearGradientPaint(float startX, float startY, float endX, float endY, float[] fractions, int[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, Transform gradientTransform) Creates a LinearGradientPaint with the specified settings.
Parameters
-
startX: The startX coordinate of the gradient in user space. -
startY: The startY coordinate of the gradient in user space. -
endX: The endX coordinate of the gradient in user space. -
endY: THe endY coordinate of the gradient in user space. -
fractions: Fractional positions of where gradient colors begin. Each value should be between 0 and 1. -
colors: The colors to use in the gradient. There should be the same number of colors as there are fractions. -
cycleMethod: The cycle method to use. -
colorSpace: The color space to use. -
gradientTransform: Transform to use for the gradient. Not used right now.
-
-
LinearGradientPaint
public LinearGradientPaint(double startX, double startY, double endX, double endY, float[] fractions, int[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, Transform gradientTransform) Creates a LinearGradientPaint with the specified settings.
Parameters
-
startX: The startX coordinate of the gradient in user space. -
startY: The startY coordinate of the gradient in user space. -
endX: The endX coordinate of the gradient in user space. -
endY: THe endY coordinate of the gradient in user space. -
fractions: Fractional positions of where gradient colors begin. Each value should be between 0 and 1. -
colors: The colors to use in the gradient. There should be the same number of colors as there are fractions. -
cycleMethod: The cycle method to use. -
colorSpace: The color space to use. -
gradientTransform: Transform to use for the gradient. Not used right now.
-
-
-
Method Details
-
paint
Paints linear gradient in the given bounds.
Parameters
-
g -
bounds
-
-
paint
Painds the linear gradient in the given bounds.
Parameters
-
g -
x -
y -
w -
h
-
-