Class Stop

  • public final class Stop
    extends Object
    Defines one element of the ramp of colors to use on a gradient. For more information see javafx.scene.paint.LinearGradient and javafx.scene.paint.RadialGradient.


     // 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();
    JavaFX 2.0
    • Constructor Detail

      • Stop

        public Stop​(double offset,
                    Color color)
        Creates a new instance of Stop.
        offset - Stop's position (ranging from 0 to 1
        color - Stop's color
    • Method Detail

      • getOffset

        public final double getOffset()
        Gets a number ranging from 0 to 1 that indicates where this gradient stop is placed. For linear gradients, the offset variable 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.
        position of the Stop within the gradient (ranging from 0 to 1)
      • getColor

        public final Color getColor()
        Gets the color of the gradient at this offset.
        the color of the gradient at this offset
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one.
        equals in class Object
        obj - the reference object with which to compare.
        true if this object is equal to the obj argument; false otherwise.
        See Also:
        Object.hashCode(), HashMap
      • toString

        public String toString()
        Returns a string representation of this Stop object.
        toString in class Object
        a string representation of this Stop object.