Class DerivableImageIcon

java.lang.Object
com.github.weisj.darklaf.icons.DerivableImageIcon
All Implemented Interfaces:
DerivableIcon<DerivableImageIcon>, ImageSource, Accessible, Icon

public class DerivableImageIcon extends Object implements DerivableIcon<DerivableImageIcon>, ImageSource, Accessible
  • Constructor Details

    • DerivableImageIcon

      public DerivableImageIcon(String imagePath)
      Create a new derivable image icon.
      Parameters:
      imagePath - the image path.
    • DerivableImageIcon

      public DerivableImageIcon(String imagePath, int width, int height)
      Create a new derivable image icon.
      Parameters:
      imagePath - the image path.
      width - the icon width.
      height - the icon height.
    • DerivableImageIcon

      public DerivableImageIcon(String imagePath, int width, int height, int scalingMode)
      Create a new derivable image icon.
      Parameters:
      imagePath - the image path.
      width - the icon width.
      height - the icon height.
      scalingMode - One of Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING, Image.SCALE_SMOOTH
    • DerivableImageIcon

      public DerivableImageIcon(URL url)
      Create a new derivable image icon.
      Parameters:
      url - the url to load the image from.
    • DerivableImageIcon

      public DerivableImageIcon(URL url, int width, int height)
      Create a new derivable image icon.
      Parameters:
      url - the url to load the image from.
      width - the icon width.
      height - the icon height.
    • DerivableImageIcon

      public DerivableImageIcon(URL url, int width, int height, int scalingMode)
      Create a new derivable image icon.
      Parameters:
      url - the url to load the image from.
      width - the icon width.
      height - the icon height.
      scalingMode - One of Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING, Image.SCALE_SMOOTH
    • DerivableImageIcon

      public DerivableImageIcon(Supplier<Image> imageSupplier)
    • DerivableImageIcon

      public DerivableImageIcon(Supplier<Image> imageSupplier, int width, int height)
    • DerivableImageIcon

      public DerivableImageIcon(Supplier<Image> imageSupplier, int width, int height, int scalingMode)
    • DerivableImageIcon

      public DerivableImageIcon(ImageIcon icon)
      Create a new derivable image icon.
      Parameters:
      icon - the source image icon.
    • DerivableImageIcon

      public DerivableImageIcon(ImageIcon icon, int scalingMode)
      Create a new derivable image icon with specified scalingMode.
      Parameters:
      icon - the source icon.
      scalingMode - One of Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING, Image.SCALE_SMOOTH
    • DerivableImageIcon

      public DerivableImageIcon(ImageIcon icon, int width, int height)
      Create a new derivable image icon with specified scalingMode.
      Parameters:
      icon - the source icon.
      width - the icon width.
      height - the icon height.
    • DerivableImageIcon

      public DerivableImageIcon(ImageIcon icon, int width, int height, int scalingMode)
      Create a new derivable image icon with specified scalingMode. If the source image doesnt match the specified dimensions it will be scaled accordingly.
      Parameters:
      icon - the source icon.
      width - the icon width.
      height - the icon height.
      scalingMode - One of Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING, Image.SCALE_SMOOTH
    • DerivableImageIcon

      public DerivableImageIcon(Image img)
      Create a new derivable image.
      Parameters:
      img - the source image.
    • DerivableImageIcon

      public DerivableImageIcon(Image img, int scalingMode)
      Create a new derivable image icon with specified scalingMode.
      Parameters:
      img - the source image.
      scalingMode - One of Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING, Image.SCALE_SMOOTH
    • DerivableImageIcon

      public DerivableImageIcon(Image img, int width, int height)
      Create a new derivable image icon with default scalingMode. If the source image doesnt match the specified dimensions it will be scaled accordingly.
      Parameters:
      img - the source image.
      width - the icon width.
      height - the icon height.
    • DerivableImageIcon

      public DerivableImageIcon(Image img, int width, int height, int scalingMode)
      Create a new derivable image icon with specified scalingMode. If the source image doesnt match the specified dimensions it will be scaled accordingly.
      Parameters:
      img - the source image.
      width - the icon width.
      height - the icon height.
      scalingMode - One of Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING, Image.SCALE_SMOOTH
    • DerivableImageIcon

      protected DerivableImageIcon(DerivableImageIcon parent, int width, int height)
  • Method Details

    • derive

      public DerivableImageIcon derive(int width, int height)
      Description copied from interface: DerivableIcon
      Derive a new icon with the specified size.
      Specified by:
      derive in interface DerivableIcon<DerivableImageIcon>
      Parameters:
      width - the new width
      height - the new height.
      Returns:
      the derived icon.
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Specified by:
      paintIcon in interface Icon
    • getImage

      public Image getImage()
      Get the underlying Image.
      Returns:
      the image.
    • getImage

      public Image getImage(ImageObserver observer)
      Get the underlying Image.
      Parameters:
      observer - the ImageObserver.
      Returns:
      the image.
    • getOriginal

      protected Image getOriginal()
    • getIconWidth

      public int getIconWidth()
      Specified by:
      getIconWidth in interface Icon
    • getIconHeight

      public int getIconHeight()
      Specified by:
      getIconHeight in interface Icon
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
    • getDescription

      public String getDescription()
      Gets the description of the image. This is meant to be a brief textual description of the object. For example, it might be presented to a blind user to give an indication of the purpose of the image. The description may be null.
      Returns:
      a brief textual description of the image
    • setDescription

      public void setDescription(String description)
      Sets the description of the image. This is meant to be a brief textual description of the object. For example, it might be presented to a blind user to give an indication of the purpose of the image.
      Parameters:
      description - a brief textual description of the image
    • createImage

      public Image createImage(Dimension size)
      Specified by:
      createImage in interface ImageSource