ptolemy.vergil.icon
Class ImageIcon
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.vergil.icon.EditorIcon
ptolemy.vergil.icon.DynamicEditorIcon
ptolemy.vergil.icon.ImageIcon
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class ImageIcon
- extends DynamicEditorIcon
- implements java.awt.image.ImageObserver
An icon that displays a specified java.awt.Image.
- Since:
- Ptolemy II 4.0
- Version:
- $Id: ImageIcon.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary |
ImageIcon(NamedObj container,
java.lang.String name)
Create a new icon with the given name in the given container. |
Method Summary |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
Figure |
createBackgroundFigure()
Create a new default background figure, which is the shape set
by setShape, if it has been called, or a small box if not. |
boolean |
imageUpdate(java.awt.Image image,
int infoflags,
int x,
int y,
int width,
int height)
This method, which is required by the ImageObserver interface,
is called if something has changed in a background loading of
the image. |
void |
scaleImage(double percentage)
Specify a scaling for the image as a percentage. |
void |
setImage(java.awt.Image image)
Specify an image to display. |
Methods inherited from class ptolemy.kernel.util.Attribute |
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_height
private int _height
_image
private java.awt.Image _image
_scaledImage
private java.awt.Image _scaledImage
_scalePercentage
private double _scalePercentage
_width
private int _width
ImageIcon
public ImageIcon(NamedObj container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Create a new icon with the given name in the given container.
- Parameters:
container
- The container.name
- The name of the attribute.
- Throws:
IllegalActionException
- If the attribute is not of an
acceptable class for the container.
NameDuplicationException
- If the name coincides with
an attribute already in the container.
clone
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
- Clone the object into the specified workspace. The new object is
not added to the directory of that workspace (you must do this
yourself if you want it there).
The result is an object with no container.
- Overrides:
clone
in class DynamicEditorIcon
- Parameters:
workspace
- The workspace for the cloned object.
- Returns:
- The new Attribute.
- Throws:
java.lang.CloneNotSupportedException
- Not thrown in this base class- See Also:
NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
createBackgroundFigure
public Figure createBackgroundFigure()
- Create a new default background figure, which is the shape set
by setShape, if it has been called, or a small box if not.
This must be called in the Swing thread, or a concurrent
modification exception could occur.
- Overrides:
createBackgroundFigure
in class EditorIcon
- Returns:
- A figure representing the specified shape.
imageUpdate
public boolean imageUpdate(java.awt.Image image,
int infoflags,
int x,
int y,
int width,
int height)
- This method, which is required by the ImageObserver interface,
is called if something has changed in a background loading of
the image.
- Specified by:
imageUpdate
in interface java.awt.image.ImageObserver
- Parameters:
image
- The image being observed.infoflags
- The bitwise inclusive OR of the following flags:
WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR,
ABORT.x
- The x coordinate of the image.y
- The y coordinate of the image.width
- The width of the image.height
- The height of the image.
- Returns:
- False if the infoflags indicate that the image is
completely loaded; true otherwise.
scaleImage
public void scaleImage(double percentage)
- Specify a scaling for the image as a percentage.
- Parameters:
percentage
- The scaling percentage.
setImage
public void setImage(java.awt.Image image)
- Specify an image to display. This is deferred and executed
in the Swing thread.
- Parameters:
image
- The image to display.