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
,java.io.Serializable
,java.lang.Cloneable
,javax.accessibility.Accessible
,javax.swing.Icon
@OpenApiAll public class RetinaImageIcon extends ResizableIconImageIcon
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RetinaImageIcon(ResizableIcon icon)
Constructor.RetinaImageIcon(ResizableIcon icon, int width, int height)
Constructor.RetinaImageIcon(java.awt.Image image)
Constructor.RetinaImageIcon(java.awt.Image image, int width, int height)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIconHeight()
int
getIconWidth()
void
paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
void
paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y, int w, int h)
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
-
-
-
-
Constructor Detail
-
RetinaImageIcon
public RetinaImageIcon(ResizableIcon icon)
Constructor. Scales down given icon by retina factor.- Parameters:
icon
- given icon
-
RetinaImageIcon
public RetinaImageIcon(ResizableIcon icon, int width, int height)
Constructor. Scales down given icon to the given width and height.- Parameters:
icon
- given icon
-
RetinaImageIcon
public RetinaImageIcon(java.awt.Image image, int width, int height)
Constructor. Scales down given icon to the given width and height.- Parameters:
image
- given image
-
RetinaImageIcon
public RetinaImageIcon(java.awt.Image image)
Constructor. Scales down given image by retina factor.- Parameters:
image
- given image
-
-
Method Detail
-
paintIcon
public void paintIcon(@CheckForNull java.awt.Component c, java.awt.Graphics g, int x, int y, int w, int h)
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
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
- Specified by:
paintIcon
in interfacejavax.swing.Icon
- Overrides:
paintIcon
in classScalableImageIcon
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth
in interfacejavax.swing.Icon
- Overrides:
getIconWidth
in classScalableImageIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight
in interfacejavax.swing.Icon
- Overrides:
getIconHeight
in classScalableImageIcon
-
-