Class ImageCursorBuilder

java.lang.Object
io.github.sosuisen.jfxbuilder.graphics.ImageCursorBuilder

public class ImageCursorBuilder extends Object
The ImageCursorBuilder class constructs instances of the ImageCursor class and offers a fluent interface for creating and configuring it.

This class includes a static create method that accepts the same arguments as the original ImageCursor constructor and returns an instance of the ImageCursorBuilder.

You can use method chaining to call the builder methods for configuring the ImageCursor. Finally, invoke the build method to generate an instance of the ImageCursor class.

Note that intermediate builder methods are not evaluated until the build method is called, meaning they are evaluated lazily.

Author:
Hidekazu Kubota <hidekazu.kubota@gmail.com>
  • Method Details

    • create

      public static ImageCursorBuilder create()
      Returns an instance of the ImageCursorBuilder.
      Returns:
      an instance of the ImageCursorBuilder.
    • create

      public static ImageCursorBuilder create(Image image)
      Accepts the constructor arguments of ImageCursor(Image) and returns an instance of ImageCursorBuilder.
      Returns:
      an instance of the ImageCursorBuilder.
    • create

      public static ImageCursorBuilder create(Image image, double hotspotX, double hotspotY)
      Accepts the constructor arguments of ImageCursor(Image, double, double) and returns an instance of ImageCursorBuilder.
      Returns:
      an instance of the ImageCursorBuilder.
    • build

      public ImageCursor build()
      Builds and returns an instance of the ImageCursor class.

      Intermediate builder methods are not evaluated until the build method is called; in other words, they are evaluated lazily.

      Returns:
      new instance of the ImageCursor class
    • apply

      public ImageCursorBuilder apply(Consumer<ImageCursor> func)
      Applies a function to the ImageCursor instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • hotspotXPropertyApply

      public ImageCursorBuilder hotspotXPropertyApply(Consumer<ReadOnlyDoubleProperty> op)
      Applies a function to the hotspotXProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.hotspotXProperty().bind(anotherProperty))
      
      // Use shorthand form
      .hotspotXPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • hotspotYPropertyApply

      public ImageCursorBuilder hotspotYPropertyApply(Consumer<ReadOnlyDoubleProperty> op)
      Applies a function to the hotspotYProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.hotspotYProperty().bind(anotherProperty))
      
      // Use shorthand form
      .hotspotYPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • imagePropertyApply

      public ImageCursorBuilder imagePropertyApply(Consumer<ReadOnlyObjectProperty<Image>> op)
      Applies a function to the imageProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.imageProperty().bind(anotherProperty))
      
      // Use shorthand form
      .imagePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance