Package com.github.weisj.darklaf.icons
Class DerivableImageIcon
- java.lang.Object
-
- com.github.weisj.darklaf.icons.DerivableImageIcon
-
- All Implemented Interfaces:
DerivableIcon<DerivableImageIcon>,Accessible,Icon
public class DerivableImageIcon extends Object implements DerivableIcon<DerivableImageIcon>, Accessible
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDerivableImageIcon.AccessibleDerivableImageIconprotected static classDerivableImageIcon.LazyImageValue
-
Constructor Summary
Constructors Modifier Constructor Description protectedDerivableImageIcon(DerivableImageIcon parent, int width, int height)DerivableImageIcon(Image img)Create a new derivable image.DerivableImageIcon(Image img, int scalingMode)Create a new derivable image icon with specified scalingMode.DerivableImageIcon(Image img, int width, int height)Create a new derivable image icon with default scalingMode.DerivableImageIcon(Image img, int width, int height, int scalingMode)Create a new derivable image icon with specified scalingMode.DerivableImageIcon(String imagePath)Create a new derivable image icon.DerivableImageIcon(String imagePath, int width, int height)Create a new derivable image icon.DerivableImageIcon(String imagePath, int width, int height, int scalingMode)Create a new derivable image icon.DerivableImageIcon(URL url)Create a new derivable image icon.DerivableImageIcon(URL url, int width, int height)Create a new derivable image icon.DerivableImageIcon(URL url, int width, int height, int scalingMode)Create a new derivable image icon.DerivableImageIcon(Supplier<Image> imageSupplier)DerivableImageIcon(Supplier<Image> imageSupplier, int width, int height)DerivableImageIcon(Supplier<Image> imageSupplier, int width, int height, int scalingMode)DerivableImageIcon(ImageIcon icon)Create a new derivable image icon.DerivableImageIcon(ImageIcon icon, int scalingMode)Create a new derivable image icon with specified scalingMode.DerivableImageIcon(ImageIcon icon, int width, int height)Create a new derivable image icon with specified scalingMode.DerivableImageIcon(ImageIcon icon, int width, int height, int scalingMode)Create a new derivable image icon with specified scalingMode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DerivableImageIconderive(int width, int height)Derive a new icon with the specified size.AccessibleContextgetAccessibleContext()StringgetDescription()Gets the description of the image.intgetIconHeight()intgetIconWidth()ImagegetImage()Get the underlyingImage.protected ImagegetOriginal()voidpaintIcon(Component c, Graphics g, int x, int y)voidsetDescription(String description)Sets the description of the image.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.weisj.darklaf.icons.DerivableIcon
copy
-
-
-
-
Constructor Detail
-
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 ofImage.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 ofImage.SCALE_DEFAULT,Image.SCALE_FAST,Image.SCALE_REPLICATE,Image.SCALE_AREA_AVERAGING,Image.SCALE_SMOOTH
-
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 ofImage.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 ofImage.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 ofImage.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 ofImage.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 Detail
-
derive
public DerivableImageIcon derive(int width, int height)
Description copied from interface:DerivableIconDerive a new icon with the specified size.- Specified by:
derivein interfaceDerivableIcon<DerivableImageIcon>- Parameters:
width- the new widthheight- the new height.- Returns:
- the derived icon.
-
getOriginal
protected Image getOriginal()
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidthin interfaceIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeightin interfaceIcon
-
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Specified by:
getAccessibleContextin interfaceAccessible
-
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
-
-