Class RotatedIcon
java.lang.Object
org.bidib.wizard.mvc.common.view.icon.RotatedIcon
- All Implemented Interfaces:
Icon,AnimatedIcon
The RotatedIcon allows you to change the orientation of an Icon by rotating the Icon before it is painted. This class
supports the following orientations:
- DOWN - rotated 90 degrees
- UP (default) - rotated -90 degrees
- UPSIDE_DOWN - rotated 180 degrees
- ABOUT_CENTER - the icon is rotated by the specified degrees about its center.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRotatedIcon(Icon icon) Convenience constructor to create a RotatedIcon that is rotated DOWN.RotatedIcon(Icon icon, double degrees) Create a RotatedIcon.RotatedIcon(Icon icon, double degrees, boolean circularIcon) Create a RotatedIcon.RotatedIcon(Icon icon, RotatedIcon.Rotate rotate) Create a RotatedIcon -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets the degrees of rotation.getIcon()Gets the Icon to be rotatedintGets the height of this icon.intGets the width of this icon.Gets the Rotate enum which indicates the direction of rotationbooleanIs the image circular or rectangular?voidPaint the icons of this compound icon at the specified locationvoidsetCircularIcon(boolean circularIcon) Set the Icon as circular or rectangular.voidsetDegrees(double degrees) Set the degrees of rotation.
-
Constructor Details
-
RotatedIcon
Convenience constructor to create a RotatedIcon that is rotated DOWN.- Parameters:
icon- the Icon to rotate
-
RotatedIcon
Create a RotatedIcon- Parameters:
icon- the Icon to rotaterotate- the direction of rotation
-
RotatedIcon
Create a RotatedIcon. The icon will rotate about its center. This constructor will automatically set the Rotate enum to ABOUT_CENTER.- Parameters:
icon- the Icon to rotatedegrees- the degrees of rotation
-
RotatedIcon
Create a RotatedIcon. The icon will rotate about its center. This constructor will automatically set the Rotate enum to ABOUT_CENTER.- Parameters:
icon- the Icon to rotatedegrees- the degrees of rotationcircularIcon- treat the icon as circular so its size doesn't change
-
-
Method Details
-
getIcon
Gets the Icon to be rotated- Returns:
- the Icon to be rotated
-
getRotate
Gets the Rotate enum which indicates the direction of rotation- Returns:
- the Rotate enum
-
getDegrees
public double getDegrees()Gets the degrees of rotation. Only used for Rotate.ABOUT_CENTER.- Returns:
- the degrees of rotation
-
setDegrees
public void setDegrees(double degrees) Set the degrees of rotation. Only used for Rotate.ABOUT_CENTER. This method only sets the degress of rotation, it will not cause the Icon to be repainted. You must invoke repaint() on any component using this icon for it to be repainted.- Specified by:
setDegreesin interfaceAnimatedIcon- Parameters:
degrees- the degrees of rotation
-
isCircularIcon
public boolean isCircularIcon()Is the image circular or rectangular? Only used for Rotate.ABOUT_CENTER. When true, the icon width/height will not change as the Icon is rotated.- Returns:
- true for a circular Icon, false otherwise
-
setCircularIcon
public void setCircularIcon(boolean circularIcon) Set the Icon as circular or rectangular. Only used for Rotate.ABOUT_CENTER. When true, the icon width/height will not change as the Icon is rotated.- Parameters:
circularIcon- true for a circular Icon, false otherwise
-
getIconWidth
public int getIconWidth()Gets the width of this icon.- Specified by:
getIconWidthin interfaceIcon- Returns:
- the width of the icon in pixels.
-
getIconHeight
public int getIconHeight()Gets the height of this icon.- Specified by:
getIconHeightin interfaceIcon- Returns:
- the height of the icon in pixels.
-
paintIcon
Paint the icons of this compound icon at the specified location
-