Groovy Documentation

com.wordpress.tipsforjava.swing
[Java] Class RotatedIcon

java.lang.Object
  com.wordpress.tipsforjava.swing.RotatedIcon
All Implemented Interfaces:
Icon

public class RotatedIcon
extends Object

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:

Authors:
Rob Camick
Darryl Burke


Nested Class Summary
enum RotatedIcon.Rotate

 
Field Summary
private double angle

private Icon icon

The RotatedIcon allows you to change the orientation of an Icon by rotating the Icon before it is painted.

private RotatedIcon.Rotate rotate

 
Constructor Summary
RotatedIcon(Icon icon)

Convenience constructor to create a RotatedIcon that is rotated DOWN.

RotatedIcon(Icon icon, RotatedIcon.Rotate rotate)

Create a RotatedIcon

RotatedIcon(Icon icon, double angle)

Create a RotatedIcon.

 
Method Summary
double getAngle()

Gets the angle of rotation.

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

void paintIcon(Component c, Graphics g, int x, int y)

Paint the icons of this compound icon at the specified location

RotatedIcon valueOf(String name)

Returns the enum constant of this type with the specified name.

RotatedIcon[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

angle

private double angle


icon

private Icon 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:
Authors:
Rob Camick
Darryl Burke


rotate

private RotatedIcon.Rotate rotate


 
Constructor Detail

RotatedIcon

public RotatedIcon(Icon icon)
Convenience constructor to create a RotatedIcon that is rotated DOWN.
Parameters:
icon - the Icon to rotate


RotatedIcon

public RotatedIcon(Icon icon, RotatedIcon.Rotate rotate)
Create a RotatedIcon
Parameters:
icon - the Icon to rotate
rotate - the direction of rotation


RotatedIcon

public RotatedIcon(Icon icon, double angle)
Create a RotatedIcon. The icon will rotate about its center. This constructor will automatically set the Rotate enum to ABOUT_CENTER. For rectangular icons the icon will be clipped before the rotation to make sure it doesn't paint over the rest of the component.
Parameters:
icon - the Icon to rotate
angle - the angle of rotation


 
Method Detail

getAngle

public double getAngle()
Gets the angle of rotation. Only use for Rotate.ABOUT_CENTER.
Returns:
the angle of rotation


getIcon

public Icon getIcon()
Gets the Icon to be rotated
Returns:
the Icon to be rotated


getIconHeight

de
public int getIconHeight()
Gets the height of this icon.
Returns:
the height of the icon in pixels.


getIconWidth

de
public int getIconWidth()
Gets the width of this icon.
Returns:
the width of the icon in pixels.


getRotate

public RotatedIcon.Rotate getRotate()
Gets the Rotate enum which indicates the direction of rotation
Returns:
the Rotate enum


paintIcon

de
public void paintIcon(Component c, Graphics g, int x, int y)
Paint the icons of this compound icon at the specified location
Parameters:
c - The component on which the icon is painted
g - the graphics context
x - the X coordinate of the icon's top-left corner
y - the Y coordinate of the icon's top-left corner


valueOf

RotatedIcon valueOf(String name)
Returns the enum constant of this type with the specified name.


values

RotatedIcon[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


 

Groovy Documentation