public class IlvReliefRectangle extends IlvRectangle
IlvReliefRectangle
represents a rectangle in relief with a
customizable fill color.
The default values for an IlvReliefRectangle
instance are as
follows:
Color.black
Color.black
IlvRect(0, 0, 100, 100)
2
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 IlvReliefRectangle
in a
simple Java application:
IlvManager manager = new IlvManager(); IlvReliefRectangle myDefaultRect = new IlvReliefRectangle(); // Set size, position and the relief thickness. IlvReliefRectangle myCustomRect = new IlvReliefRectangle(new IlvRect(120, 100, 80, 20), 6); myCustomRect.setBackground(Color.green); manager.addObject(myDefaultRect, true); manager.addObject(myCustomRect, true);
The following image shows the graphic objects created in the code example:
>
IlvReliefRectangle
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.
IlvRectangle
,
IlvManager
,
IlvManagerView
,
Serialized FormBOTTOM_LEFT, BOTTOM_RIGHT, drawrect, TOP_LEFT, TOP_RIGHT
Constructor and Description |
---|
IlvReliefRectangle()
Creates a new
IlvReliefRectangle with a (0, 0, 100, 100)
definition rectangle. |
IlvReliefRectangle(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvReliefRectangle(IlvRect rect)
Creates a new Relief rectangle.
|
IlvReliefRectangle(IlvRect rect,
int thickness)
Creates a new Relief rectangle.
|
IlvReliefRectangle(IlvReliefRectangle source)
Creates a new Relief rectangle 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 |
getThickness()
Returns the thickness of the object.
|
void |
setCorners(int corners)
On
IlvReliefRectangle this method does nothing. |
void |
setFillOn(boolean value)
On
IlvReliefRectangle this method does nothing. |
void |
setRadius(int radius)
On
IlvReliefRectangle this method does nothing. |
void |
setStrokeOn(boolean value)
On
IlvReliefRectangle this method does nothing. |
void |
setThickness(int thickness)
Changes the thickness of the object.
|
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 IlvReliefRectangle()
IlvReliefRectangle
with a (0, 0, 100, 100)
definition rectangle.IlvReliefRectangle(IlvRect)
public IlvReliefRectangle(IlvRect rect)
rect
- The definition rect
of the rectangle.public IlvReliefRectangle(IlvRect rect, int thickness)
rect
- The definition rect
of the rectangle.thickness
- The thickness of the relief.public IlvReliefRectangle(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.IlvReadFileException
public IlvReliefRectangle(IlvReliefRectangle source)
source
- The origin of the copy.public int getThickness()
public void setThickness(int thickness)
public IlvGraphic copy()
copy
in class IlvRectangle
IlvGraphic
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvRectangle
dst
- The destination Graphics.t
- The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
protected void drawContent(Graphics dst, IlvRect rect, IlvTransformer t)
draw
.
The implementation is empty, but this method can be overwritten
in order to perform additional drawings inside the relief rectangle.
Note that this method may not be called by draw
if the
object is too small and only relief shadows can be drawn.dst
- The Graphics to perform the drawing.rect
- The rectangle defining the inner part of the relief rectangle
(that is, the bounding box with the relief 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)
IlvReliefRectangle
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)
IlvReliefRectangle
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)
IlvReliefRectangle
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)
IlvReliefRectangle
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 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 Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.