Class TLcdRotatingIcon

java.lang.Object
com.luciad.gui.swing.TLcdRotatingIcon
All Implemented Interfaces:
ILcdIcon, ILcdCloneable, Serializable, Cloneable, Icon

public class TLcdRotatingIcon extends Object implements ILcdIcon, Cloneable, Icon
Icon wrapper that paints the delegate icon rotated.
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, a JLabel 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 to TLcdGXYIconPainter.setUseOrientation(boolean) or TLspIconStyle#usesOrientation for more information.
Since:
9.0
See Also:
  • Constructor Details

    • TLcdRotatingIcon

      public TLcdRotatingIcon(String aIconIdentifier)
      Convenience constructor to create an automatically rotating image icon.
      Parameters:
      aIconIdentifier - The identifier for the icon. All strings accepted by TLcdIconFactory.create(String) are accepted.
    • TLcdRotatingIcon

      public TLcdRotatingIcon(String aIconIdentifier, boolean aAutomaticRotation)
      Convenience constructor to create a rotating image icon.
      Parameters:
      aIconIdentifier - The identifier for the icon. All strings accepted by TLcdIconFactory.create(String) are accepted.
      aAutomaticRotation - true for automatic rotation, false for manual rotation.
    • TLcdRotatingIcon

      public TLcdRotatingIcon(ILcdIcon aIconToRotate)
      Creates an automatically rotating icon from the given icon.
      Parameters:
      aIconToRotate - The icon to rotate.
    • TLcdRotatingIcon

      public TLcdRotatingIcon(ILcdIcon aIconToRotate, boolean aAutomaticRotation)
      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 interface Icon
      Specified by:
      getIconWidth in interface ILcdIcon
      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 interface Icon
      Specified by:
      getIconHeight in interface ILcdIcon
      Returns:
      the fixed height of the icon.
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from 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 interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • paintIcon

      public void paintIcon(Component aComponent, Graphics aGraphics, int aX, int aY)
      Description copied from interface: ILcdIcon
      Draw the ILcdIcon at the specified location. ILcdIcon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.
      Specified by:
      paintIcon in interface Icon
      Specified by:
      paintIcon in interface ILcdIcon
      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

      public String toString()
      Overrides:
      toString in class Object