- java.lang.Object
-
- javafx.scene.paint.Stop
-
public final class Stop extends Object
Defines one element of the ramp of colors to use on a gradient. For more information seejavafx.scene.paint.LinearGradientandjavafx.scene.paint.RadialGradient.Example:
// object bounding box relative (proportional:true, default) Stop[] stops = { new Stop(0, Color.WHITE), new Stop(1, Color.BLACK)}; LinearGradient lg = new LinearGradient(0, 0, 1, 0, true, CycleMethod.No_CYCLE, stops); Rectangle r = new Rectangle(); r.setFill(lg);- Since:
- JavaFX 2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Indicates whether some other object is "equal to" this one.ColorgetColor()Gets the color of the gradient at this offset.doublegetOffset()Gets a number ranging from0to1that indicates where this gradient stop is placed.inthashCode()Returns a hash code for thisStopobject.StringtoString()Returns a string representation of thisStopobject.
-
-
-
Constructor Detail
-
Stop
public Stop(double offset, Color color)Creates a new instance of Stop.- Parameters:
offset- Stop's position (ranging from0to1color- Stop's color
-
-
Method Detail
-
getOffset
public final double getOffset()
Gets a number ranging from0to1that indicates where this gradient stop is placed. For linear gradients, theoffsetvariable represents a location along the gradient vector. For radial gradients, it represents a percentage distance from the focus point to the edge of the outermost/largest circle.- Returns:
- position of the Stop within the gradient
(ranging from
0to1)
-
getColor
public final Color getColor()
Gets the color of the gradient at this offset.- Returns:
- the color of the gradient at this offset
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.- Overrides:
equalsin classObject- Parameters:
obj- the reference object with which to compare.- Returns:
trueif this object is equal to theobjargument;falseotherwise.- See Also:
Object.hashCode(),HashMap
-
hashCode
public int hashCode()
Returns a hash code for thisStopobject.- Overrides:
hashCodein classObject- Returns:
- a hash code for this
Stopobject. - See Also:
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
-