@OpenApiAll public final class SquareIcon extends ResizableIconImageIcon
ResizableIconImageIcon.ResizableIconLoader
ScalableImageIcon.AbstractImageLoader
Modifier and Type | Method and Description |
---|---|
(package private) static ResizableIcon |
create(ResizableIcon icon,
int size,
double maxScale)
Convert given icon to a scaled icon which fits to a square of given size.
|
static ResizableIcon |
fit(ResizableIcon icon,
int size)
Convert given icon to a scaled icon which fits to a square of given size.
|
static ResizableIcon |
fitOrCenter(ResizableIcon icon,
int size)
Convert given icon to a scaled icon which fits to a square of given size.
|
int |
getIconHeight() |
int |
getIconWidth() |
java.lang.Double |
getScale() |
static double |
getScale(javax.swing.Icon icon,
int size)
Utility method to calculate a scale factor of given icon if it needs to be fit into a square of given size.
|
static java.awt.Dimension |
getScaleSize(javax.swing.Icon icon,
int size)
Utility method to calculate dimension of given icon if it needs to be fit into a square of given size.
|
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.
|
static ResizableIcon |
scale(ResizableIcon icon,
double scale)
Convert given icon to a scaled icon with given scale(zoom) factor.
|
clone, create, doNotScale, getImage, getLocation, getURL, internalGetIcon, internalSetLoader, internalSuperGetImage, setImage, toImageIcon, toImageIcon, toImageIcon
public static ResizableIcon fit(ResizableIcon icon, int size)
icon
- iconsize
- square sizepublic static ResizableIcon fitOrCenter(ResizableIcon icon, int size)
icon
- iconsize
- square sizestatic ResizableIcon create(ResizableIcon icon, int size, double maxScale)
icon
- iconsize
- square sizemaxScale
- max icon scale factor.public static ResizableIcon scale(ResizableIcon icon, double scale)
icon
- iconscale
- scale factorpublic static java.awt.Dimension getScaleSize(javax.swing.Icon icon, int size)
icon
- iconsize
- square sizepublic static double getScale(javax.swing.Icon icon, int size)
icon
- iconsize
- square sizepublic void paintIcon(@CheckForNull java.awt.Component c, java.awt.Graphics g, int x, int y, int w, int h)
ResizableIcon
paintIcon
in interface ResizableIcon
paintIcon
in class ScalableImageIcon
c
- the given component.g
- the graphics to paint on.x
- x coordinate.y
- y coordinate.w
- width to paint.h
- height to paint.public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
paintIcon
in class ScalableImageIcon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
getIconWidth
in class ScalableImageIcon
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
getIconHeight
in class ScalableImageIcon
public java.lang.Double getScale()