public final class ImageUtilities
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
static java.awt.Image |
addToolTipToImage(java.awt.Image image,
java.lang.String text) |
Add text to tool tip for given image (creates new or returns cached, original remains unmodified)
Text can contain HTML tags e.g.
|
static java.awt.Image |
assignToolTipToImage(java.awt.Image image,
java.lang.String text) |
Assign tool tip text to given image (creates new or returns cached, original remains unmodified)
Text can contain HTML tags e.g.
|
static javax.swing.Icon |
createDisabledIcon(javax.swing.Icon icon) |
Creates disabled (color saturation lowered) icon.
|
static java.awt.Image |
createDisabledImage(java.awt.Image image) |
Creates disabled (color saturation lowered) image.
|
static java.lang.String |
getImageToolTip(java.awt.Image image) |
Get tool tip text for given image
|
static java.awt.Image |
icon2Image(javax.swing.Icon icon) |
Converts given icon to a
Image. |
static javax.swing.Icon |
image2Icon(java.awt.Image image) |
Converts given image to an icon.
|
static java.awt.Image |
loadImage(java.lang.String resourceID) |
Loads an image from the specified resource ID.
|
static java.awt.Image |
loadImage(java.lang.String resource,
boolean localized) |
Loads an image based on resource path.
|
static javax.swing.ImageIcon |
loadImageIcon(java.lang.String resource,
boolean localized) |
Loads an icon based on resource path.
|
static java.awt.Image |
mergeImages(java.awt.Image image1,
java.awt.Image image2,
int x,
int y) |
This method merges two images into the new one.
|
public static final java.awt.Image loadImage(java.lang.String resourceID)
resourceID - resource path of the icon (no initial slash)public static final java.awt.Image loadImage(java.lang.String resource,
boolean localized)
loadImage(String) but may do a localized search.
For example, requesting org/netbeans/modules/foo/resources/foo.gif
might actually find org/netbeans/modules/foo/resources/foo_ja.gif
or org/netbeans/modules/foo/resources/foo_mybranding.gif.
Caching of loaded images can be used internally to improve performance.
Since version 8.12 the returned image object responds to call
image.getProperty("url", null) by returning the internal
URL of the found and loaded resource.
If the current look and feel is 'dark' (UIManager.getBoolean("nb.dark.theme"))
then the method first attempts to load image <original file name>_dark.<original extension>.
If such file doesn't exist the default one is loaded instead.
resource - resource path of the image (no initial slash)localized - true for localized searchpublic static final javax.swing.ImageIcon loadImageIcon(java.lang.String resource,
boolean localized)
loadImage(String, boolean), returns ImageIcon instead of Image.
If the current look and feel is 'dark' (UIManager.getBoolean("nb.dark.theme"))
then the method first attempts to load image <original file name>_dark.<original extension>.
If such file doesn't exist the default one is loaded instead.
resource - resource path of the icon (no initial slash)localized - localized resource should be usedpublic static final java.awt.Image mergeImages(java.awt.Image image1,
java.awt.Image image2,
int x,
int y)
image1 - underlying imageimage2 - second imagex - x position of top-left cornery - y position of top-left cornerpublic static final javax.swing.Icon image2Icon(java.awt.Image image)
image - to be convertedpublic static final java.awt.Image icon2Image(javax.swing.Icon icon)
Image.icon - Icon to be converted.public static final java.awt.Image assignToolTipToImage(java.awt.Image image,
java.lang.String text)
image - image to which tool tip should be settext - tool tip textpublic static final java.lang.String getImageToolTip(java.awt.Image image)
image - image which is asked for tool tip textpublic static final java.awt.Image addToolTipToImage(java.awt.Image image,
java.lang.String text)
text - text to add to tool tippublic static javax.swing.Icon createDisabledIcon(javax.swing.Icon icon)
icon - original icon used for conversionpublic static java.awt.Image createDisabledImage(java.awt.Image image)
image - original image used for conversionBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.