Package com.tagtraum.core.swing
Class MultiResolutionIcon
- java.lang.Object
-
- com.tagtraum.core.swing.MultiResolutionIcon
-
- All Implemented Interfaces:
Accessible
,Icon
public class MultiResolutionIcon extends Object implements Icon, Accessible
Multi-resolution icon. Suitable for Retina/HiDPI displays.- Author:
- Hendrik Schreiber
- See Also:
ImageFX.getHiDPIScaleFactor(java.awt.Graphics)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MultiResolutionIcon.AccessibleImageIcon
This class implements accessibility support for theImageIcon
class.
-
Constructor Summary
Constructors Constructor Description MultiResolutionIcon(Image... images)
MultiResolutionIcon(String resourceName, Class<?> klass)
Lazily creates a multi-resolution icon from the given resource and package.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiResolutionIcon
filter(BufferedImageOp op)
Filters all images with the givenBufferedImageOp
.AccessibleContext
getAccessibleContext()
Gets the AccessibleContext associated with this ImageIcon.String
getDescription()
Gets the description of the image.int
getIconHeight()
int
getIconWidth()
Image[]
getImages()
void
paintIcon(Component c, Graphics g, int x, int y)
void
setDescription(String description)
Sets the description of the image.String
toString()
Returns a string representation of this image.
-
-
-
Constructor Detail
-
MultiResolutionIcon
public MultiResolutionIcon(String resourceName, Class<?> klass) throws FileNotFoundException
Lazily creates a multi-resolution icon from the given resource and package.- Parameters:
resourceName
- resource nameklass
- class which package should be searched- Throws:
FileNotFoundException
- if no corresponding resource can be found
-
MultiResolutionIcon
public MultiResolutionIcon(Image... images)
- Parameters:
images
- images with HiDPI scale factors 1, 2, 4, 8, etc.
-
-
Method Detail
-
getImages
public Image[] getImages()
-
filter
public MultiResolutionIcon filter(BufferedImageOp op)
Filters all images with the givenBufferedImageOp
.- Parameters:
op
- operation- Returns:
- new icon
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth
in interfaceIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight
in interfaceIcon
-
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
-
toString
public String toString()
Returns a string representation of this image.
-
getAccessibleContext
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this ImageIcon. For image icons, the AccessibleContext takes the form of an AccessibleImageIcon. A new AccessibleImageIcon instance is created if necessary.- Specified by:
getAccessibleContext
in interfaceAccessible
- Returns:
- an AccessibleImageIcon that serves as the AccessibleContext of this ImageIcon
-
-