public final class IconLoader
extends java.lang.Object
IconUtil
Modifier and Type | Class and Description |
---|---|
static class |
IconLoader.CachedImageIcon |
static class |
IconLoader.LazyIcon
Consider using
#createLazy) . |
Modifier and Type | Method and Description |
---|---|
static void |
activate() |
static void |
clearCache() |
static javax.swing.Icon |
copy(javax.swing.Icon icon,
java.awt.Component ancestor,
boolean deepCopy) |
static javax.swing.Icon |
createLazy(java.util.function.Supplier<javax.swing.Icon> producer) |
static void |
deactivate() |
static void |
detachClassLoader(java.lang.ClassLoader classLoader) |
static javax.swing.Icon |
filterIcon(javax.swing.Icon icon,
java.util.function.Supplier<? extends java.awt.image.RGBImageFilter> filterSupplier,
java.awt.Component ancestor)
Creates new icon with the filter applied.
|
static javax.swing.Icon |
findIcon(java.lang.String path)
Might return null if icon was not found.
|
static javax.swing.Icon |
findIcon(java.lang.String path,
boolean strict) |
static javax.swing.Icon |
findIcon(java.lang.String path,
java.lang.Class<?> aClass)
Might return null if icon was not found.
|
static javax.swing.Icon |
findIcon(java.lang.String path,
java.lang.Class<?> aClass,
boolean computeNow) |
static javax.swing.Icon |
findIcon(java.lang.String path,
java.lang.Class<?> aClass,
boolean computeNow,
boolean strict) |
static javax.swing.Icon |
findIcon(java.lang.String path,
java.lang.ClassLoader classLoader) |
static javax.swing.Icon |
findIcon(java.net.URL url) |
static javax.swing.Icon |
findIcon(java.net.URL url,
boolean useCache) |
static javax.swing.Icon |
findLafIcon(java.lang.String key,
java.lang.Class<?> aClass,
boolean strict) |
static javax.swing.Icon |
getDarkIcon(javax.swing.Icon icon,
boolean dark)
Returns a copy of the provided
icon with darkness set to dark . |
static javax.swing.Icon |
getDisabledIcon(javax.swing.Icon icon)
Gets (creates if necessary) disabled icon based on the passed one.
|
static javax.swing.Icon |
getIcon(java.awt.Image image)
Deprecated.
use
JBImageIcon |
static javax.swing.Icon |
getIcon(java.lang.String path) |
static javax.swing.Icon |
getIcon(java.lang.String path,
java.lang.Class aClass) |
static javax.swing.Icon |
getIconSnapshot(javax.swing.Icon icon)
Gets a snapshot of the icon, immune to changes made by these calls:
setFilter(ImageFilter) , setUseDarkIcons(boolean) |
static javax.swing.Icon |
getMenuBarIcon(javax.swing.Icon icon,
boolean dark)
For internal usage.
|
static javax.swing.Icon |
getReflectiveIcon(java.lang.String path,
java.lang.ClassLoader classLoader) |
static javax.swing.Icon |
getTransparentIcon(javax.swing.Icon icon) |
static javax.swing.Icon |
getTransparentIcon(javax.swing.Icon icon,
float alpha) |
static void |
installPathPatcher(IconPathPatcher patcher) |
static boolean |
isGoodSize(javax.swing.Icon icon) |
static <T,E extends java.lang.Throwable> |
performStrictly(ThrowableComputable<T,E> computable) |
static void |
removePathPatcher(IconPathPatcher patcher) |
static void |
setFilter(java.awt.image.ImageFilter filter) |
static void |
setStrictGlobally(boolean strict) |
static void |
setUseDarkIcons(boolean useDarkIcons) |
static java.awt.Image |
toImage(javax.swing.Icon icon) |
static java.awt.Image |
toImage(javax.swing.Icon icon,
ScaleContext ctx) |
public static <T,E extends java.lang.Throwable> T performStrictly(ThrowableComputable<T,E> computable) throws E extends java.lang.Throwable
E extends java.lang.Throwable
public static void setStrictGlobally(boolean strict)
public static void installPathPatcher(IconPathPatcher patcher)
public static void removePathPatcher(IconPathPatcher patcher)
@Deprecated public static javax.swing.Icon getIcon(java.awt.Image image)
JBImageIcon
public static void setUseDarkIcons(boolean useDarkIcons)
public static void setFilter(java.awt.image.ImageFilter filter)
public static void clearCache()
public static javax.swing.Icon getIcon(java.lang.String path)
public static javax.swing.Icon getReflectiveIcon(java.lang.String path, java.lang.ClassLoader classLoader)
public static javax.swing.Icon findIcon(java.lang.String path)
getIcon(String)
public static javax.swing.Icon findIcon(java.lang.String path, boolean strict)
public static javax.swing.Icon getIcon(java.lang.String path, java.lang.Class aClass)
public static void activate()
public static void deactivate()
public static javax.swing.Icon findLafIcon(java.lang.String key, java.lang.Class<?> aClass, boolean strict)
public static javax.swing.Icon findIcon(java.lang.String path, java.lang.Class<?> aClass)
getIcon(String, Class)
public static javax.swing.Icon findIcon(java.lang.String path, java.lang.Class<?> aClass, boolean computeNow)
public static javax.swing.Icon findIcon(java.lang.String path, java.lang.Class<?> aClass, boolean computeNow, boolean strict)
public static javax.swing.Icon findIcon(java.net.URL url)
public static javax.swing.Icon findIcon(java.net.URL url, boolean useCache)
public static javax.swing.Icon findIcon(java.lang.String path, java.lang.ClassLoader classLoader)
public static java.awt.Image toImage(javax.swing.Icon icon)
public static java.awt.Image toImage(javax.swing.Icon icon, ScaleContext ctx)
public static javax.swing.Icon copy(javax.swing.Icon icon, java.awt.Component ancestor, boolean deepCopy)
public static boolean isGoodSize(javax.swing.Icon icon)
public static javax.swing.Icon getDisabledIcon(javax.swing.Icon icon)
ImageIcon
constructed from disabled image of passed icon.public static javax.swing.Icon filterIcon(javax.swing.Icon icon, java.util.function.Supplier<? extends java.awt.image.RGBImageFilter> filterSupplier, java.awt.Component ancestor)
public static javax.swing.Icon getTransparentIcon(javax.swing.Icon icon)
public static javax.swing.Icon getTransparentIcon(javax.swing.Icon icon, float alpha)
public static javax.swing.Icon getIconSnapshot(javax.swing.Icon icon)
setFilter(ImageFilter)
, setUseDarkIcons(boolean)
icon
- the source iconpublic static javax.swing.Icon getMenuBarIcon(javax.swing.Icon icon, boolean dark)
public static javax.swing.Icon getDarkIcon(javax.swing.Icon icon, boolean dark)
icon
with darkness set to dark
.
The method takes effect on a IconLoader.CachedImageIcon
(or its wrapper) only.public static void detachClassLoader(java.lang.ClassLoader classLoader)
public static javax.swing.Icon createLazy(java.util.function.Supplier<javax.swing.Icon> producer)