public class RotatedIcon
extends java.lang.Object
implements javax.swing.Icon
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:
| Modifier and Type | Class and Description |
|---|---|
static class |
RotatedIcon.Rotate |
| Constructor and Description |
|---|
RotatedIcon(javax.swing.Icon icon)
Convenience constructor to create a RotatedIcon that is rotated DOWN.
|
RotatedIcon(javax.swing.Icon icon,
double degrees)
Create a RotatedIcon.
|
RotatedIcon(javax.swing.Icon icon,
double degrees,
boolean circularIcon)
Create a RotatedIcon.
|
RotatedIcon(javax.swing.Icon icon,
RotatedIcon.Rotate rotate)
Create a RotatedIcon
|
| Modifier and Type | Method and Description |
|---|---|
double |
getDegrees()
Gets the degrees of rotation.
|
javax.swing.Icon |
getIcon()
Gets the Icon to be rotated
|
int |
getIconHeight()
Gets the height of this icon.
|
int |
getIconWidth()
Gets the width of this icon.
|
RotatedIcon.Rotate |
getRotate()
Gets the Rotate enum which indicates the direction of rotation
|
boolean |
isCircularIcon()
Is the image circular or rectangular? Only used for Rotate.ABOUT_CENTER.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paint the icons of this compound icon at the specified location
|
void |
setCircularIcon(boolean circularIcon)
Set the Icon as circular or rectangular.
|
void |
setDegrees(double degrees)
Set the degrees of rotation.
|
public RotatedIcon(javax.swing.Icon icon)
icon - the Icon to rotatepublic RotatedIcon(javax.swing.Icon icon,
RotatedIcon.Rotate rotate)
icon - the Icon to rotaterotate - the direction of rotationpublic RotatedIcon(javax.swing.Icon icon,
double degrees)
icon - the Icon to rotatedegrees - the degrees of rotationpublic RotatedIcon(javax.swing.Icon icon,
double degrees,
boolean circularIcon)
icon - the Icon to rotatedegrees - the degrees of rotationcircularIcon - treat the icon as circular so its size doesn't changepublic javax.swing.Icon getIcon()
public RotatedIcon.Rotate getRotate()
public double getDegrees()
public void setDegrees(double degrees)
degrees - The degrees of rotationpublic boolean isCircularIcon()
public void setCircularIcon(boolean circularIcon)
circularIcon - true for a circular Icon, false otherwisepublic int getIconWidth()
getIconWidth in interface javax.swing.Iconpublic int getIconHeight()
getIconHeight in interface javax.swing.Iconpublic void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
paintIcon in interface javax.swing.Iconc - The component on which the icon is paintedg - The graphics contextx - The X coordinate of the icon's top-left cornery - The Y coordinate of the icon's top-left corner