java.lang.Object
furbelow.ScaledIcon
- All Implemented Interfaces:
Icon
Provides a scaled version of a given icon. Aspect ratio
is optionally preserved; the icon will be centered in any extra space
given its size.
-
Constructor Summary
ConstructorsConstructorDescriptionScaledIcon
(Icon icon) Create a scalable version of the given Icon.ScaledIcon
(Icon icon, int width, int height) Create an icon that properly scales to the desired size.ScaledIcon
(Icon icon, int width, int height, boolean preserveAspect) Create an icon that properly scales to the desired size, and whether to preserve the aspect ratio. -
Method Summary
Modifier and TypeMethodDescriptionint
int
void
Paint the icon scaled appropriately.void
setPreserveAspect
(boolean p) void
setSize
(int w, int h) void
-
Constructor Details
-
ScaledIcon
Create a scalable version of the given Icon. -
ScaledIcon
Create an icon that properly scales to the desired size. The aspect ratio will be preserved. -
ScaledIcon
Create an icon that properly scales to the desired size, and whether to preserve the aspect ratio.
-
-
Method Details
-
setPreserveAspect
public void setPreserveAspect(boolean p) -
setSize
-
setSize
public void setSize(int w, int h) -
paintIcon
Paint the icon scaled appropriately. -
getIconWidth
public int getIconWidth()- Specified by:
getIconWidth
in interfaceIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeight
in interfaceIcon
-