Spec-Zone.ru › OpenJavaFX 8
javafx.scene.paint

Class Stop

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 see javafx.scene.paint.LinearGradient and javafx.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

  • Constructor Summary

    Constructors
    Constructor and Description
    Stop(double offset, Color color)
    Creates a new instance of Stop.
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    boolean equals(Object obj)
    Indicates whether some other object is "equal to" this one.
    Color getColor()
    Gets the color of the gradient at this offset.
    double getOffset()
    Gets a number ranging from 0 to 1 that indicates where this gradient stop is placed.
    int hashCode()
    Returns a hash code for this Stop object.
    String toString()
    Returns a string representation of this Stop object.
    • Methods inherited from class java.lang.Object

      clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Detail

    • Stop

      public Stop(double offset,
                  Color color)
      Creates a new instance of Stop.

      Parameters:

      offset - Stop's position (ranging from 0 to 1

  • 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.

      Returns:

      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.

      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:

      equals in class Object

      Parameters:

      obj - the reference object with which to compare.

      Returns:

      true if this object is equal to the obj argument; false otherwise.

    • hashCode

      public int hashCode()
      Returns a hash code for this Stop object.

      Overrides:

      hashCode in class Object

      Returns:

      a hash code for this Stop object.

    • toString

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

      Overrides:

      toString in class Object

      Returns:

      a string representation of this Stop object.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API