public class IlvImageDecoration extends IlvPositionableDecoration
IlvImageDecoration class defines three modes of drawing:
ANCHORED, to draw the image at a predefined fixed position.
In this mode, the position is expressed as one of the
SwingConstants compass-direction.
TILED, to draw the image as a replicated pattern.
SCALED, to draw the image so that it fills the plot area.
The following picture shows samples of the different modes:

IlvChartDecoration,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
ANCHORED
The
ANCHORED mode constant. |
static int |
SCALED
The
SCALED mode constant. |
static int |
TILED
The
TILED mode constant. |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| Constructor and Description |
|---|
IlvImageDecoration(Image image)
Creates a new
IlvImageDecoration object in
ANCHORED mode displaying the specified image centered
within the plot area. |
IlvImageDecoration(Image image,
int mode,
int anchor)
Creates a new
IlvImageDecoration object in the specified mode
displaying the specified image. |
IlvImageDecoration(URL imageURL,
int mode,
int anchor)
Creates a new
IlvImageDecoration object in the specified mode
displaying the image loaded from the specified URL. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
chartConnected(IlvChart oldChart,
IlvChart newChart)
Called when the decoration is added to or removed from a chart.
|
protected void |
computeLocation()
Computes the current location of the decoration, and stores the result in
the object returned by
getLocation(). |
void |
draw(Graphics g)
Draws the decoration into the specified
Graphics context. |
int |
getAnchor()
Returns the image anchor within the plot area.
|
Rectangle2D |
getBounds(Rectangle2D retBounds)
Returns the bounds of this decoration.
|
URL |
getImageURL()
Returns the URL of the image or
null if not specified. |
int |
getMode()
Returns the drawing mode.
|
Point |
getOffset()
Returns the decoration's position, relative to the anchor.
|
void |
setAnchor(int anchor)
Sets the image anchor within the plot area.
|
void |
setMode(int mode)
Sets the drawing mode.
|
void |
setOffset(Point offset)
Sets the decoration's position, relative to the anchor.
|
getLocationafterDraw, baseTextDirectionChanged, beforeDraw, componentOrientationChanged, getChart, getDrawOrder, has3DSupport, isVisible, repaint, setDrawOrder, setVisible, updateBoundsCachepublic static final int ANCHORED
ANCHORED mode constant.public static final int TILED
TILED mode constant.public static final int SCALED
SCALED mode constant.public IlvImageDecoration(Image image)
IlvImageDecoration object in
ANCHORED mode displaying the specified image centered
within the plot area.
Note that serialization of an IlvImageDecoration instance created
with this constructor will not preserve the image.ANCHOREDpublic IlvImageDecoration(Image image, int mode, int anchor)
IlvImageDecoration object in the specified mode
displaying the specified image.image - The image to display.mode - The positioning mode. One of the ANCHORED,
TILED, or SCALED constants.anchor - The image position within the plot area. This parameter is
meaningful only if the mode is set to ANCHORED. One of the
SwingConstants.CENTER, SwingConstants.NORTH,
SwingConstants.NORTH_WEST, SwingConstants.WEST,
SwingConstants.SOUTH_WEST, SwingConstants.SOUTH,
SwingConstants.SOUTH_EAST, SwingConstants.EAST,
SwingConstants.NORTH_EAST constants.
Note that serialization of an IlvImageDecoration instance created
with this constructor will not preserve the image.public IlvImageDecoration(URL imageURL, int mode, int anchor)
IlvImageDecoration object in the specified mode
displaying the image loaded from the specified URL.imageURL - The image to display.mode - The positioning mode. One of the ANCHORED,
TILED or SCALED constants.anchor - The image position within the plot area. This parameter is
meaningful only if the mode is set to ANCHORED. One of the
SwingConstants.CENTER, SwingConstants.NORTH,
SwingConstants.NORTH_WEST, SwingConstants.WEST,
SwingConstants.SOUTH_WEST, SwingConstants.SOUTH,
SwingConstants.SOUTH_EAST, SwingConstants.EAST,
SwingConstants.NORTH_EAST constants.
Note that serialization of an IlvImageDecoration instance created
with this constructor preserve the image.protected void chartConnected(IlvChart oldChart, IlvChart newChart)
chartConnected in class IlvPositionableDecorationoldChart - The chart with which the decoration was associated, or
null if the decoration is added to a new chart.newChart - The chart to which the decoration is added, or
null if the decoration is removed from its current chart.IlvChartOwnedDrawable.getChart()public final URL getImageURL()
null if not specified.public int getMode()
public void setMode(int mode)
public int getAnchor()
ANCHORED.getAnchor in class IlvPositionableDecorationsetAnchor(int)public void setAnchor(int anchor)
ANCHORED.setAnchor in class IlvPositionableDecorationanchor - One of the
SwingConstants.CENTER,
SwingConstants.NORTH,
SwingConstants.NORTH_WEST,
SwingConstants.WEST,
SwingConstants.SOUTH_WEST,
SwingConstants.SOUTH,
SwingConstants.SOUTH_EAST,
SwingConstants.EAST,
SwingConstants.NORTH_EAST constants.public Point getOffset()
ANCHORED.getOffset in class IlvPositionableDecorationsetOffset(java.awt.Point)public void setOffset(Point offset)
ANCHORED.setOffset in class IlvPositionableDecorationpublic void draw(Graphics g)
Graphics context.draw in interface IlvChartDrawabledraw in class IlvChartDecorationpublic Rectangle2D getBounds(Rectangle2D retBounds)
getBounds in interface IlvChartDrawablegetBounds in class IlvPositionableDecorationretBounds - A rectangle used to store the result. If this parameter
is null, a new Rectangle2D is allocated.protected void computeLocation()
getLocation().computeLocation in class IlvPositionableDecoration© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.