public class IlvShadowRectangle extends IlvRectangle
IlvShadowRectangle
represents a rectangle with a shadow.
The default values for an IlvShadowRectangle
instance are as
follows:
Color.black
Color.black
IlvRect(0, 0, 100, 100)
4
IlvConstants.BOTTOM_RIGHT
Note: calls to the following methods result in a
RuntimeException
being thrown:
setCorners(int)
setFillOn(boolean)
setRadius(int)
setStrokeOn(boolean)
The following code example shows how to use an IlvShadowRectangle
in a
simple Java application:
IlvManager manager = new IlvManager(); IlvShadowRectangle myDefaultRect = new IlvShadowRectangle(); IlvShadowRectangle myCustomRect = new IlvShadowRectangle( new IlvRect(60,90,80,20), 6, IlvConstants.TOP_LEFT); myCustomRect.setForeground(Color.blue); myCustomRect.setBackground(Color.yellow); manager.addObject( myDefaultRect, true); manager.addObject( myCustomRect, true);
The following image shows the graphic objects created in the code example:
>
IlvShadowRectangle
is a custom graphic object, that is, a subclass of
IlvGraphic
. Graphic objects are controlled using an
IlvManager
instance and displayed using one or more
IlvManagerView
instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvRect
,
IlvManager
,
IlvManagerView
,
IlvConstants
,
Serialized FormBOTTOM_LEFT, BOTTOM_RIGHT, drawrect, TOP_LEFT, TOP_RIGHT
Constructor and Description |
---|
IlvShadowRectangle()
Creates a new
IlvShadowRectangle with a (0, 0, 100, 100)
definition rectangle, a thickness of 2 and a IlvConstants.BOTTOM_RIGHT
shadow position. |
IlvShadowRectangle(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvShadowRectangle(IlvRect rect)
Creates a new
IlvShadowRectangle . |
IlvShadowRectangle(IlvRect rect,
double thickness,
int shadowPosition)
Creates a new
IlvShadowRectangle . |
IlvShadowRectangle(IlvShadowRectangle source)
Creates a new
IlvShadowRectangle by copying an existing one. |
Modifier and Type | Method and Description |
---|---|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
protected void |
drawContent(Graphics dst,
IlvRect rect,
IlvTransformer t)
Draws the content of the object.
|
int |
getShadowPosition()
Returns the position of the shadow.
|
double |
getThickness()
Returns the thickness of the shadow.
|
void |
setCorners(int corners)
On
IlvShadowRectangle this method does nothing. |
void |
setFillOn(boolean value)
On
IlvShadowRectangle this method does nothing. |
void |
setRadius(int radius)
On
IlvShadowRectangle this method does nothing. |
void |
setShadowPosition(int shadowPosition)
Changes the position of the shadow.
|
void |
setStrokeOn(boolean value)
On
IlvShadowRectangle this method does nothing. |
void |
setThickness(double thickness)
Changes the thickness of the shadow.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
applyTransform, boundingBox, contains, getBackground, getCorners, getDefinitionRect, getForeground, getIntersectionWithOutline, getRadius, isCornersZoomable, isFillOn, isStrokeOn, moveResize, resize, setBackground, setCornersZoomable, setDefinitionRect, setForeground, translate
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, 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, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, rotate, scale, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable
public IlvShadowRectangle()
IlvShadowRectangle
with a (0, 0, 100, 100)
definition rectangle, a thickness of 2 and a IlvConstants.BOTTOM_RIGHT
shadow position.IlvShadowRectangle(IlvRect, double, int)
public IlvShadowRectangle(IlvRect rect, double thickness, int shadowPosition)
IlvShadowRectangle
.rect
- The definition rectangle of the object.thickness
- The thickness of the shadow.shadowPosition
- The position of the shadow.
Valid values are IlvConstants.TOP_LEFT
,
IlvConstants.BOTTOM_LEFT
, IlvConstants.TOP_RIGHT
, or
IlvConstants.BOTTOM_RIGHT
.public IlvShadowRectangle(IlvRect rect)
IlvShadowRectangle
.
The thickness is set to 5
and the shadow position
to IlvConstants.BOTTOM_RIGHT
.rect
- The definition rectangle of the object.public IlvShadowRectangle(IlvShadowRectangle source)
IlvShadowRectangle
by copying an existing one.source
- The copied object.public IlvShadowRectangle(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.IlvReadFileException
public IlvGraphic copy()
copy
in class IlvRectangle
IlvGraphic
public int getShadowPosition()
IlvConstants.TOP_LEFT
,
IlvConstants.BOTTOM_LEFT
, IlvConstants.TOP_RIGHT
,
IlvConstants.BOTTOM_RIGHT
.public void setShadowPosition(int shadowPosition)
shadowPosition
- The new position of the shadow. Valid values are
IlvConstants.TOP_LEFT
, IlvConstants.BOTTOM_LEFT
, or
IlvConstants.TOP_RIGHT
, IlvConstants.BOTTOM_RIGHT
.public double getThickness()
public void setThickness(double thickness)
thickness
- The new thickness.protected void drawContent(Graphics dst, IlvRect rect, IlvTransformer t)
draw
.
The implementation is empty, but this method can be overridden
to perform additional drawings inside the shadow rectangle.dst
- The Graphics to perform the drawing.rect
- The rectangle defining the inner part of the shadow rectangle
(that is, the bounding box with the shadow removed). Note that this
rectangle is already transformed by the transformer used to
draw the object.t
- The transformer used to draw the object.public final void setRadius(int radius)
IlvShadowRectangle
this method does nothing.setRadius
in class IlvRectangle
radius
- The new radius.IlvRectangle.getRadius()
,
IlvRectangle.getCorners()
,
IlvRectangle.setCornersZoomable(boolean)
public final void setStrokeOn(boolean value)
IlvShadowRectangle
this method does nothing.setStrokeOn
in class IlvRectangle
value
- Set to true
to enable the stroke in your
customized graphic object.IlvRectangle.isStrokeOn()
public final void setFillOn(boolean value)
IlvShadowRectangle
this method does nothing.setFillOn
in class IlvRectangle
value
- Set to true
to enable the fill style for this
graphic object.IlvRectangle.isFillOn()
public final void setCorners(int corners)
IlvShadowRectangle
this method does nothing.setCorners
in class IlvRectangle
corners
- A combination of the following values:
IlvRectangle.TOP_LEFT
: top left corner.
IlvRectangle.TOP_RIGHT
: top right corner.
IlvRectangle.BOTTOM_RIGHT
: bottom right corner.
IlvRectangle.BOTTOM_LEFT
: bottom left corner.
IlvRectangle.getCorners()
,
IlvRectangle.setCornersZoomable(boolean)
,
IlvRectangle.setRadius(int)
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvRectangle
dst
- The destination Graphics.t
- The transformer used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
Note that even if this is a public method, you should not
call it directly. You should use the write
methods of the manager.write
in interface IlvPersistentObject
write
in class IlvRectangle
stream
- 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.