public class IlvIcon extends IlvGraphic implements ImageObserver
IlvIcon is a graphic object that displays an image.
The following code example shows how to use IlvIcon in a
simple Java application:
URL filePath = null;
IlvManager manager = new IlvManager();
try {
filePath = new URL("file:logo.gif");
} catch (MalformedURLException e)
{
}
IlvIcon icon = new IlvIcon(filePath, new IlvRect(10,10,203,97));
manager.addObject(icon, 1, true);
The following image shows the graphic objects created in the code example:
>
IlvIcon is a custom graphic object, that is, a subclass of
IlvGraphic. Graphic objects are controlled using an instance of
IlvManager or one of its subclasses, and displayed using one or
more IlvManagerView instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvManager,
IlvManagerView,
IlvRect,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected IlvRect |
drawrect
Deprecated.
The object is now defined by a definition rectangle that is
obtained by taking the result of a call to
getDefinitionRect() and
applying getTransformer() to it. |
static boolean |
hideStackTraceInImageUpdate
Allows to switch off stack traces inside the image update process.
|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
IlvIcon()
Creates an empty
IlvIcon. |
IlvIcon(IlvIcon source)
Creates a new
IlvIcon by copying an existing one. |
IlvIcon(IlvInputStream stream)
Reads the object from an
IlvInputStream. |
IlvIcon(Image image,
IlvRect rect)
Creates a new
IlvIcon. |
IlvIcon(RenderedImage renderedImage,
IlvRect rect)
Creates a new
IlvIcon to display the
RenderedImage given as a parameter. |
IlvIcon(String file,
IlvRect rect)
Creates a new
IlvIcon. |
IlvIcon(URL url,
IlvRect rect)
Creates a new
IlvIcon. |
| Modifier and Type | Method and Description |
|---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
float |
getAlpha()
Returns the alpha value of this graphic object.
|
Shape |
getClip()
Returns the shape that will clip the object.
|
IlvRect |
getDefinitionRect()
Returns the definition rectangle of the
IlvIcon. |
Image |
getImage()
Returns the image.
|
String |
getImageLocation()
Returns the image location.
|
RenderedImage |
getRenderedImage()
Returns the
RenderedImage. |
IlvTransformer |
getTransformer()
Returns the transformer that is currently applied to the
IlvIcon. |
boolean |
imageUpdate(Image img,
int flags,
int x,
int y,
int w,
int h)
Redraws the object when the image is fully loaded.
|
boolean |
isAutoResizing()
Returns whether or not the
IlvIcon will be resized automatically to
the width/height of the Image when setImageLocation(String) or
setImage(Image) is called. |
boolean |
isHighQualityRendering()
Returns
true if high rendering quality mode is set. |
void |
setAlpha(float alpha)
Changes the alpha value of this graphic object.
|
void |
setAutoResizing(boolean value)
Sets whether or not the
IlvIcon will be resized automatically to
the width/height of the Image when setImageLocation(String) or
setImage(Image) is called. |
void |
setClip(Shape clip)
Changes the shape that will clip the object.
|
void |
setGraphicBag(IlvGraphicBag bag)
Overrides the method to restart an animated GIF, if
necessary.
|
void |
setHighQualityRendering(boolean value)
Changes the rendering quality state of the image.
|
void |
setImage(Image image)
Changes the image.
|
void |
setImageLocation(String location)
Changes the image.
|
void |
setRenderedImage(RenderedImage rimage)
Changes the
RenderedImage. |
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream. |
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, makeSelection, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setForeground, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable@Deprecated protected final IlvRect drawrect
getDefinitionRect() and
applying getTransformer() to it.public static boolean hideStackTraceInImageUpdate
imageUpdate(java.awt.Image, int, int, int, int, int) is called for an animated GIF image, the image
is redrawn. Exceptions during this redraw might cause the image to display
partially incorrect but are usually harmless for the remaining system.
By default, the stack trace of these exceptions is shown on the console.
But when setting this flag to true, the stack trace can be suppressed.public IlvIcon()
IlvIcon.
The image used by the IlvIcon must be set
later on with setImageLocation(String), setImage(Image) or
setRenderedImage(RenderedImage).
The image will be loaded synchronously
and the definition rectangle of the image getDefinitionRect() will be
computed from the image size.isAutoResizing()public IlvIcon(RenderedImage renderedImage, IlvRect rect)
IlvIcon to display the
RenderedImage given as a parameter.
Note that when you create an IlvIcon
with this constructor, the IlvIcon
cannot be saved in an IVL file.renderedImage - The RenderedImage.rect - The definition rectangle of the object.public IlvIcon(Image image, IlvRect rect)
IlvIcon.
Note that when you create an IlvIcon
with this constructor, the IlvIcon
cannot be saved in an IVL file.image - The image.rect - The definition rectangle of the object.public IlvIcon(URL url, IlvRect rect)
IlvIcon.url - The image URL.rect - The definition rectangle of the object.public IlvIcon(String file, IlvRect rect)
IlvIcon.file - The file location of the image.rect - The definition rectangle of the object.public IlvIcon(IlvIcon source)
IlvIcon by copying an existing one.source - The source icon.public IlvIcon(IlvInputStream stream) throws IlvReadFileException
IlvInputStream.stream - The input stream.IlvReadFileException - if the format is not correct.public IlvGraphic copy()
copy in class IlvGraphicIlvGraphicpublic Image getImage()
public RenderedImage getRenderedImage()
RenderedImage.public void setRenderedImage(RenderedImage rimage)
RenderedImage.
Note that when you change the image
with this method, the IlvIcon
can no longer be saved in an IVL file.rimage - The new rendered image.setImageLocation(java.lang.String)public void setImage(Image image)
IlvIcon if
isAutoResizing() returns true.
Note that when you change the image
with this method, the IlvIcon
can no longer be saved in an IVL file.image - The new image.setImageLocation(java.lang.String)public String getImageLocation()
public void setImageLocation(String location)
IlvIcon if
isAutoResizing() returns true.location - A string containing the URL of the image.public IlvTransformer getTransformer()
IlvIcon.public void setClip(Shape clip)
null if no clip is applied.clip - The new clip.public Shape getClip()
null if no clip is applied. The shape is modified when a
transformation is applied to the object.public void setAlpha(float alpha)
If the containers of the graphic object (manager layer, graphic set) have their own alpha value, the object draws with a composed alpha value.
The default value is 1.
alpha - The new transparency level in the range [0.0, 1.0].getAlpha(),
IlvManagerLayer.setAlpha(float)public float getAlpha()
setAlpha(float),
IlvManagerLayer.getAlpha()public void setHighQualityRendering(boolean value)
true
will improve the rendering.
The default value is false.value - The value.public boolean isHighQualityRendering()
true if high rendering quality mode is set.setHighQualityRendering(boolean)public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
imageUpdate in interface ImageObserverpublic void setGraphicBag(IlvGraphicBag bag)
setGraphicBag in class IlvGraphicbag - The graphic bag.IlvGraphicpublic void draw(Graphics dst, IlvTransformer t)
draw in class IlvGraphicdst - The destination Graphics.t - The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer),
IlvGraphic.boundingBox(IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic IlvRect getDefinitionRect()
IlvIcon. This is the
IlvRect that has been used at construction time.
The IlvIcon is defined by a definition rectangle that is
obtained by taking the result returned by this method and applying
getTransformer() to it.public IlvRect boundingBox(IlvTransformer t)
boundingBox in class IlvGraphict - The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains in class IlvGraphicp - The point to be tested.tp - The point p transformed by the transformer
t.t - The transformation that was applied to the object when it
was drawn.true if the point lies inside this graphic object.IlvGraphicpublic void applyTransform(IlvTransformer t)
applyTransform in class IlvGraphict - The transformer to be applied.IlvGraphicpublic final void setAutoResizing(boolean value)
IlvIcon will be resized automatically to
the width/height of the Image when setImageLocation(String) or
setImage(Image) is called.
The default value is false except when the IlvIcon() constructor
is used.value - Sets whether the IlvIcon will be resized automatically or not.public final boolean isAutoResizing()
IlvIcon will be resized automatically to
the width/height of the Image when setImageLocation(String) or
setImage(Image) is called.
The default value is false except when the IlvIcon() constructor
is used.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream.
You should not call this
method directly; instead, you should use the write
methods of the manager.write in interface IlvPersistentObjectwrite in class IlvGraphicstream - The output stream.IOException - thrown when an exception occurs during
the write operation for this object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.