Package com.nomagic.ui
Class RetinaImageIcon
java.lang.Object
javax.swing.ImageIcon
com.nomagic.ui.ScalableImageIcon
com.nomagic.ui.ResizableIconImageIcon
com.nomagic.ui.RetinaImageIcon
- All Implemented Interfaces:
ResizableIcon
,Serializable
,Cloneable
,Accessible
,Icon
Retina friendly image icon implementation. Icon(and image returned by this icon) is twice smaller then the wrapped icon itself.
Wrapped icon is used for painting. On paint Graphics is scaled down by retina scale factor and wrapped icon is painted.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRetinaImageIcon
(ResizableIcon icon) Constructor.RetinaImageIcon
(ResizableIcon icon, int width, int height) Constructor.RetinaImageIcon
(Image image) Constructor.RetinaImageIcon
(Image image, int width, int height) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
int
void
void
Draw the icon in the given bounds.Methods inherited from class com.nomagic.ui.ScalableImageIcon
clone, create, doNotScale, getImage, getLocation, getURL, setImage, toImageIcon, toImageIcon, toImageIcon
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getImageLoadStatus, getImageObserver, loadImage, setDescription, setImageObserver, toString
-
Constructor Details
-
RetinaImageIcon
Constructor. Scales down given icon by retina factor.- Parameters:
icon
- given icon
-
RetinaImageIcon
Constructor. Scales down given icon to the given width and height.- Parameters:
icon
- given icon
-
RetinaImageIcon
Constructor. Scales down given icon to the given width and height.- Parameters:
image
- given image
-
RetinaImageIcon
Constructor. Scales down given image by retina factor.- Parameters:
image
- given image
-
-
Method Details
-
paintIcon
Description copied from interface:ResizableIcon
Draw the icon in the given bounds. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIcon
in interfaceResizableIcon
- Overrides:
paintIcon
in classScalableImageIcon
- Parameters:
c
- the given component.g
- the graphics to paint on.x
- x coordinate.y
- y coordinate.w
- width to paint.h
- height to paint.
-
paintIcon
- Specified by:
paintIcon
in interfaceIcon
- Overrides:
paintIcon
in classScalableImageIcon
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidth
in interfaceIcon
- Overrides:
getIconWidth
in classScalableImageIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeight
in interfaceIcon
- Overrides:
getIconHeight
in classScalableImageIcon
-