Package com.luciad.gui
Class TLcdResizeableIcon
java.lang.Object
com.luciad.gui.TLcdResizeableIcon
- All Implemented Interfaces:
ILcdAnchoredIcon
,ILcdIcon
,ILcdResizeableIcon
,ILcdCloneable
,Serializable
,Cloneable
Wrapper implementation of ILcdResizeableIcon
that rescales the
wrapped icon when it is too large to fit the given size. When the wrapped icon
is smaller than the asked size, it is painted centered.
Notice that this class is not guaranteed to work correctly with non-static icons.
- Since:
- 9.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdResizeableIcon
(ILcdIcon aDelegateIcon) Constructs a newTLcdResizeableIcon
with the height and width of the iconaDelegateIcon
.TLcdResizeableIcon
(ILcdIcon aDelegateIcon, int aIconWidth, int aIconHeight) Constructs a newTLcdResizeableIcon
where the width and/or height can be specified. -
Method Summary
Modifier and TypeMethodDescriptionvoid
anchorPointSFCT
(Point aPointSFCT) Updates the given point to the location of the icon's anchor point, in relative coordinates with respect to the top left.clone()
MakesObject.clone()
public.boolean
Returns the base icon.int
Returns the fixed height of the icon.int
Returns the fixed width of the icon.int
hashCode()
void
Draw theILcdIcon
at the specified location.void
setDelegateIcon
(ILcdIcon aDelegateIcon) Sets the base icon.void
setIconHeight
(int aIconHeight) Set the height of the icon.void
setIconWidth
(int aIconWidth) Set the width of the icon.toString()
-
Constructor Details
-
TLcdResizeableIcon
Constructs a newTLcdResizeableIcon
with the height and width of the iconaDelegateIcon
. Notice that this class is not guaranteed to work correctly with non-static icons.- Parameters:
aDelegateIcon
- the base icon. Must not benull
-
TLcdResizeableIcon
Constructs a newTLcdResizeableIcon
where the width and/or height can be specified. Notice that this class is not guaranteed to work correctly with non-static icons.- Parameters:
aDelegateIcon
- the base icon.null
is allowed: nothing is painted.aIconWidth
- when set to -1, the width is scaled in a relative manner. The height must be set in this case to a value greater than zeroaIconHeight
- when set to -1, the height is scaled in a relative manner. The width must be set in this case to a value greater than zero
-
-
Method Details
-
getDelegateIcon
Returns the base icon.
- Returns:
- the base icon
- See Also:
-
setDelegateIcon
Sets the base icon.
- Parameters:
aDelegateIcon
- the new base icon- 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 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.
-
setIconWidth
public void setIconWidth(int aIconWidth) Description copied from interface:ILcdResizeableIcon
Set the width of the icon.- Specified by:
setIconWidth
in interfaceILcdResizeableIcon
- Parameters:
aIconWidth
- the new width.
-
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.
-
setIconHeight
public void setIconHeight(int aIconHeight) Description copied from interface:ILcdResizeableIcon
Set the height of the icon.- Specified by:
setIconHeight
in interfaceILcdResizeableIcon
- Parameters:
aIconHeight
- the new height.
-
equals
-
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:
-
hashCode
public int hashCode() -
anchorPointSFCT
Updates the given point to the location of the icon's anchor point, in relative coordinates with respect to the top left. The x-coordinate of the anchor point typically lies between 0 and getWidth(). The y-coordinate typically lies between 0 and getHeight().This implementation reuses the anchor point of the delegate icon. If the delegate icon is resized, the anchor point is shifted accordingly. If the delegate icon is not anchored, the icon center is returned.
- Specified by:
anchorPointSFCT
in interfaceILcdAnchoredIcon
- Parameters:
aPointSFCT
- the point that has to be moved to the location of the anchor point
-
toString
-