Package com.luciad.gui.swing
Class TLcdRotatingIcon
java.lang.Object
com.luciad.gui.swing.TLcdRotatingIcon
- All Implemented Interfaces:
ILcdIcon
,ILcdCloneable
,Serializable
,Cloneable
,Icon
Icon wrapper that paints the delegate icon rotated.
For convenience, it implements the Swing
For convenience, it implements the Swing
Icon
interface.
Continuous Rotation
The icon's automatic rotation is very suited to implement rotating "busy" indicators. When enabled the icon rotates itself continuously, so adding it to, for example, aJLabel
is all that needs to be done.
Caveats
- The bounds of this icon are not adjusted according to the rotation angle: you should use an icon that does not exceed the original bounds when rotated.
- The automatic rotation behavior is not designed to be used in GXY or Lightspeed views.
- If your domain object has a changing rotation, consider using
ILcdOriented
instead. Refer toTLcdGXYIconPainter.setUseOrientation(boolean)
orTLspIconStyle#usesOrientation
for more information.
- Since:
- 9.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdRotatingIcon
(ILcdIcon aIconToRotate) Creates an automatically rotating icon from the given icon.TLcdRotatingIcon
(ILcdIcon aIconToRotate, boolean aAutomaticRotation) Creates a rotating icon from the given icon.TLcdRotatingIcon
(String aIconIdentifier) Convenience constructor to create an automatically rotating image icon.TLcdRotatingIcon
(String aIconIdentifier, boolean aAutomaticRotation) Convenience constructor to create a rotating image icon. -
Method Summary
Modifier and TypeMethodDescriptionclone()
MakesObject.clone()
public.int
Returns the fixed height of the icon.int
Returns the fixed width of the icon.void
Draw theILcdIcon
at the specified location.void
reset()
Resets the icon rotation.void
rotate
(double aAngleStepRadians) Rotates the icon over the given amount.toString()
-
Constructor Details
-
TLcdRotatingIcon
Convenience constructor to create an automatically rotating image icon.- Parameters:
aIconIdentifier
- The identifier for the icon. All strings accepted byTLcdIconFactory.create(String)
are accepted.
-
TLcdRotatingIcon
Convenience constructor to create a rotating image icon.- Parameters:
aIconIdentifier
- The identifier for the icon. All strings accepted byTLcdIconFactory.create(String)
are accepted.aAutomaticRotation
-true
for automatic rotation,false
for manual rotation.
-
TLcdRotatingIcon
Creates an automatically rotating icon from the given icon.- Parameters:
aIconToRotate
- The icon to rotate.
-
TLcdRotatingIcon
Creates a rotating icon from the given icon.- Parameters:
aIconToRotate
- The icon to rotate.aAutomaticRotation
-true
for automatic rotation,false
for manual rotation.
-
-
Method Details
-
getIconWidth
public int getIconWidth()Description copied from interface:ILcdIcon
Returns the fixed width of the icon.- Specified by:
getIconWidth
in interfaceIcon
- Specified by:
getIconWidth
in interfaceILcdIcon
- Returns:
- the fixed width of the icon.
-
getIconHeight
public int getIconHeight()Description copied from interface:ILcdIcon
Returns the fixed height of the icon.- Specified by:
getIconHeight
in interfaceIcon
- Specified by:
getIconHeight
in interfaceILcdIcon
- Returns:
- the fixed height of the icon.
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.clone()
public.java.lang.Object
, it can be implemented like this:public Object clone() { try { return super.clone(); } catch ( CloneNotSupportedException e ) { // Cannot happen: extends from Object and implements Cloneable (see also Object.clone) throw new RuntimeException( e ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-
paintIcon
Description copied from interface:ILcdIcon
Draw theILcdIcon
at the specified location.ILcdIcon
implementations may use theComponent
argument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIcon
in interfaceIcon
- Specified by:
paintIcon
in interfaceILcdIcon
- Parameters:
aComponent
- a Component to retrieve properties from.aGraphics
- the Graphics on which the icon will be painted.aX
- the x position where the icon will be painted. x is the first coordinate of the top left corner point of the icon.aY
- the y position where the icon will be painted. y is the second coordinate of the top left corner point of the icon.
-
reset
public void reset()Resets the icon rotation. Should only be used if the icon was constructed with manual rotation. -
rotate
public void rotate(double aAngleStepRadians) Rotates the icon over the given amount. Should only be used if the icon was constructed with manual rotation.- Parameters:
aAngleStepRadians
- The rotation step, in radians.
-
toString
-