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
ConstructorsConstructorDescriptionRetinaImageIcon(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 TypeMethodDescriptionintintvoidvoidDraw the icon in the given bounds.Methods inherited from class com.nomagic.ui.ScalableImageIcon
clone, create, doNotScale, getImage, getLocation, getURL, setImage, toImageIcon, toImageIcon, toImageIconMethods 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:ResizableIconDraw 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:
paintIconin interfaceResizableIcon- Overrides:
paintIconin 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:
paintIconin interfaceIcon- Overrides:
paintIconin classScalableImageIcon
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidthin interfaceIcon- Overrides:
getIconWidthin classScalableImageIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeightin interfaceIcon- Overrides:
getIconHeightin classScalableImageIcon
-