public interface ILcdAnchoredIcon extends ILcdIcon
An an example, a crosshair is typically anchored at its center.
To make an arrow icon with its tip at (tix,tiy) and its tail at (tax, tay) point towards the object it represents,
the anchor point would be (tix, tij).
ILcdAnchoredIcon does not change the behavior of the paint method: anchored icons behave similarly as non-anchored icons in that they always paint their top-left corner at the given coordinates. Hence, it is up to the caller of the paint method to deal with the anchor coordinates. The following example paints an icon around its anchor:
// coordinates of the object you want to represent with an icon
Point p = ...;
Point anchor = new Point();
icon.anchorPointSFCT(anchor);
icon.paint(c, graphics, p.x - anchor.x, p.y - anchor.y);
Modifier and Type | Method and Description |
---|---|
void |
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.
|
getIconHeight, getIconWidth, paintIcon
clone
void anchorPointSFCT(Point aPointSFCT)
aPointSFCT
- the point that has to be moved to the location of the anchor point
of this icon.