Package com.luciad.gui
Class TLcdTranslatedIcon
java.lang.Object
com.luciad.gui.TLcdTranslatedIcon
- All Implemented Interfaces:
ILcdIcon
,ILcdCloneable
,Serializable
,Cloneable
This icon delegates to another
ILcdIcon
, but translates it. Note that the icon width
and height are not adapted.
This can be especially useful when creating a composite icon, as in the following example use case:
TLcdResizeableIcon raster = new TLcdResizeableIcon(
new TLcdImageIcon("images/icons/raster_layer_16.png"));
TLcdResizeableIcon deco = new TLcdResizeableIcon(
new TLcdTranslatedIcon(
new TLcdImageIcon("images/icons/add_deco_16.png"), 7, 5));
TLcdCompositeIcon icon = new TLcdCompositeIcon();
icon.addIcon(raster);
icon.addIcon(deco);
icon.setIconHeight(16);
icon.setIconWidth(16);
- Since:
- 11.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdTranslatedIcon
(ILcdIcon aDelegateIcon, int aX, int aY) Creates a newTLcdTranslatedIcon
. -
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.
-
Constructor Details
-
TLcdTranslatedIcon
Creates a newTLcdTranslatedIcon
.- Parameters:
aDelegateIcon
- the icon to delegate to.aX
- the X translation.aY
- the Y translation.
-
-
Method Details
-
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 interfaceILcdIcon
- Parameters:
c
- a Component to retrieve properties from.g
- the Graphics on which the icon will be painted.x
- the x position where the icon will be painted. x is the first coordinate of the top left corner point of the icon.y
- the y position where the icon will be painted. y is the second coordinate of the top left corner point of the icon.
-
getIconWidth
public int getIconWidth()Description copied from interface:ILcdIcon
Returns the fixed width of the icon.- 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 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:
-