public class IlvMultipleIcon extends IlvIcon
IlvMultipleIcon
is an icon that can display one image out
of multiple predefined images. The table of possible images must be passed
to the icon. Then the image to be displayed can be conveniently selected by
an index or a key.
The following code example shows how to use IlvMultipleIcon
in a
simple Java application:
IlvManager manager = new IlvManager(); IlvURLKeyTable table = new IlvURLKeyTable(); try { URL filePath = new URL("file:logo.gif"); table.add("Logo", filePath); } catch (MalformedURLException e) { } try { URL filePath = new URL("file:header.gif"); table.add("Header", filePath); } catch (MalformedURLException e) { } IlvMultipleIcon icon = new IlvMultipleIcon(table); icon.setShowing("Header"); manager.addObject(icon, 1, true);
IlvMultipleIcon
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
,
Serialized Formdrawrect, hideStackTraceInImageUpdate
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvMultipleIcon()
Creates a multiple icon.
|
IlvMultipleIcon(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvMultipleIcon(IlvMultipleIcon source)
Creates a new
IlvMultipleIcon by copying an existing one. |
IlvMultipleIcon(IlvURLKeyTable table)
Creates a multiple icon.
|
Modifier and Type | Method and Description |
---|---|
IlvGraphic |
copy()
Copies the object.
|
IlvURLKeyTable |
getImageTable()
Returns the table containing the URLs of the images.
|
int |
getShowIndex()
Returns the index of the image currently shown by the icon.
|
Object |
getShowing()
Returns the showing indicator.
|
String |
getShowKey()
Returns the key of the image currently shown by the icon.
|
void |
setImageTable(IlvURLKeyTable table)
Sets the table containing the URLs of the images that will be displayed
by this icon.
|
void |
setShowIndex(int index)
Shows an image from the table corresponding to the given index
Note that this may change its bounding rectangle.
|
void |
setShowing(Object id)
Shows an image of the list according to the given parameter which can
be either an index (Integer) or a key (String).
|
void |
setShowKey(String key)
Shows an image of the list corresponding to the given key
Note that this may change its bounding rectangle.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
applyTransform, boundingBox, contains, draw, getAlpha, getClip, getDefinitionRect, getImage, getImageLocation, getRenderedImage, getTransformer, imageUpdate, isAutoResizing, isHighQualityRendering, setAlpha, setAutoResizing, setClip, setGraphicBag, setHighQualityRendering, setImage, setImageLocation, setRenderedImage
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
public IlvMultipleIcon()
public IlvMultipleIcon(IlvURLKeyTable table)
public IlvMultipleIcon(IlvMultipleIcon source)
IlvMultipleIcon
by copying an existing one.source
- The source icon.public IlvMultipleIcon(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvIcon
IlvGraphic
public void setImageTable(IlvURLKeyTable table)
applyToObject
method of the manager.table
- The table.public IlvURLKeyTable getImageTable()
null
.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 IlvPersistentObject
write
in class IlvIcon
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public void setShowIndex(int index)
applyToObject
method of the manager.index
- The index.public int getShowIndex()
public void setShowKey(String key)
applyToObject
method of the manager.key
- The key.public String getShowKey()
null
if the image currently shown is not from the
table.public void setShowing(Object id)
applyToObject
method of the manager.id
- The index or key.public Object getShowing()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.