Class ImageIcon.Builder

java.lang.Object
com.luciad.drawing.ImageIcon.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
ImageIcon

public static final class ImageIcon.Builder extends Object implements AutoCloseable
Builder which takes images as input to create an IIcon.
Since:
2023.1
  • Constructor Details Link icon

  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • build Link icon

      @NotNull public IIcon build() throws IllegalStateException
      Returns the IIcon based on the provided images.
      Returns:
      the IIcon based on the provided images.
      Throws:
      IllegalStateException - If no images have been set.
    • addImage Link icon

      @NotNull public ImageIcon.Builder addImage(@NotNull Image image, double displayScale) throws NullPointerException, IllegalArgumentException
      Adds an Image to the icon builder.

      The anchor point is place at the center of the image.

      When an image is already provided for a given display scale the last call overrides the previous image.

      Parameters:
      image - The image. Cannot be null.
      displayScale - The display scale factor for the image. Must be > 0.
      Returns:
      this builder.
      Throws:
      NullPointerException - when the image is a null value.
      IllegalArgumentException - when the display scale is <= 0.
    • addImage Link icon

      @NotNull public ImageIcon.Builder addImage(@NotNull Image image, double anchorX, double anchorY, double displayScale) throws NullPointerException, IllegalArgumentException
      Adds an Image to the icon builder.

      When an image is already provided for a given display scale the last call overrides the previous image.

      Parameters:
      image - The image. Cannot be null.
      anchorX - The x coordinate of the anchor point in pixels. This must be a value in the [0, getWidth()] range.
      anchorY - The y coordinate of the anchor point in pixels. This must be a value in the [0, getHeight()] range.
      displayScale - The display scale factor for the image. Must be > 0.
      Returns:
      this builder.
      Throws:
      NullPointerException - when the image is a null value.
      IllegalArgumentException - when the display scale is <= 0 or an invalid value is provided for the anchor point.
      See Also: