public class IlvEllipse extends IlvGraphic
IlvEllipse
represents an ellipse shape.
The default values for an IlvEllipse
instance are as
follows:
Color.black
Color.black
true
false
IlvRect(0, 0, 100, 100)
The following code example shows how to use IlvEllipse
in a
simple Java application:
IlvManager manager = new IlvManager(); // Create a customized circle. double size = 30; IlvEllipse circle = new IlvEllipse(new IlvPoint(40,40), size); circle.setFillOn(true); circle.setBackground(Color.green); circle.setForeground(Color.red); // Create an ellipse with the default settings. IlvEllipse defEllipse = new IlvEllipse(new IlvRect(60,80,50,20)); // Add the graphic objects to the manager. manager.addObject(circle,true); manager.addObject(defEllipse,true);
The following image shows the graphic objects created in the code example:
>
IlvEllipse
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 FormModifier and Type | Field and Description |
---|---|
protected IlvRect |
drawrect
The definition rectangle of the ellipse.
|
Constructor and Description |
---|
IlvEllipse()
Creates a new ellipse with a
(0, 0, 100, 100) definition rect. |
IlvEllipse(IlvEllipse source)
Creates an ellipse by copying an existing one.
|
IlvEllipse(IlvInputStream stream)
Reads the object from an
IlvInputStream |
IlvEllipse(IlvPoint center,
double radius)
Creates a new circle.
|
IlvEllipse(IlvRect rect)
Creates a new ellipse.
|
IlvEllipse(IlvRect rect,
boolean outlined,
boolean filled)
Creates a new
IlvEllipse . |
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 ellipse.
|
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.
|
Color |
getBackground()
Returns the background color of the
IlvEllipse . |
IlvRect |
getDefinitionRect()
Returns the rectangle that provides the bounds of the ellipse.
|
Color |
getForeground()
Returns the foreground color of the ellipse.
|
IlvPoint |
getIntersectionWithOutline(IlvPoint innerPoint,
IlvPoint outerPoint,
IlvTransformer t)
Returns the intersection of the line segment from inner point to outer
point with the shape of the graphic object.
|
boolean |
isFillOn()
Returns
true if the inside of the
ellipse will be filled. |
boolean |
isStrokeOn()
Returns
true if the shape of the
ellipse is stroked. |
void |
setBackground(Color color)
Changes the background color of the
IlvEllipse . |
void |
setFillOn(boolean set)
If
true , specifies that the inside of the
ellipse will be filled. |
void |
setForeground(Color color)
Changes the foreground color of the ellipse.
|
void |
setStrokeOn(boolean set)
When set to
true , specifies that the shape of the
ellipse is stroked. |
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, 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, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable
protected final IlvRect drawrect
public IlvEllipse()
(0, 0, 100, 100)
definition rect.IlvEllipse(IlvEllipse)
public IlvEllipse(IlvRect rect)
rect
- The bounding rectangle of the ellipse.public IlvEllipse(IlvPoint center, double radius)
center
- The center of the circle.radius
- The radius of the circle.public IlvEllipse(IlvRect rect, boolean outlined, boolean filled)
IlvEllipse
.rect
- The definition rectangle of the ellipse.outlined
- true
if the ellipse has to be stroked.filled
- true
if the ellipse has to be filled.setStrokeOn(boolean)
,
setFillOn(boolean)
public IlvEllipse(IlvEllipse source)
source
- The source ellipse.public IlvEllipse(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
stream
- The input stream.IlvReadFileException
- if the format is not correct.IlvReadFileException
public IlvGraphic copy()
copy
in class IlvGraphic
IlvGraphic
public final IlvRect getDefinitionRect()
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvGraphic
dst
- The destination Graphics.t
- The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
in class IlvGraphic
p
- 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.IlvGraphic
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in class IlvGraphic
t
- The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void applyTransform(IlvTransformer t)
applyTransform
in class IlvGraphic
t
- The transformer to be applied.IlvGraphic
public IlvPoint getIntersectionWithOutline(IlvPoint innerPoint, IlvPoint outerPoint, IlvTransformer t)
innerPoint
is not inside the graphic object,
or if outerPoint
is not outside the graphic object, it
must return a valid point. For instance, if there is no intersection,
it can return the start point.getIntersectionWithOutline
in class IlvGraphic
innerPoint
- A point usually inside the graphic object, given in
manager view coordinates.outerPoint
- A point usually outside of the graphic object, given in
manager view coordinates.t
- The transformation used to draw the object.IlvClippingLinkConnector
public void setForeground(Color color)
IlvBlinkingColor
.setForeground
in class IlvGraphic
color
- The new foreground color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setBackground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public Color getForeground()
public void setBackground(Color color)
IlvEllipse
. It is the
color used to fill the ellipse.
This property supports
IlvBlinkingColor
.setBackground
in class IlvGraphic
color
- The background new color.IlvGraphic.draw(Graphics, IlvTransformer)
,
IlvGraphic.setForeground(Color)
,
IlvGraphic.setFillOn(boolean)
,
IlvGraphic.setStrokeOn(boolean)
,
IlvGraphic
public Color getBackground()
IlvEllipse
. It is the
color used to fill the ellipse.public boolean isFillOn()
true
if the inside of the
ellipse will be filled.setFillOn(boolean)
public void setFillOn(boolean set)
true
, specifies that the inside of the
ellipse will be filled.setFillOn
in class IlvGraphic
set
- Set to true
to enable the fill style for this
graphic object.isFillOn()
public boolean isStrokeOn()
true
if the shape of the
ellipse is stroked.setStrokeOn(boolean)
public void setStrokeOn(boolean set)
true
, specifies that the shape of the
ellipse is stroked.setStrokeOn
in class IlvGraphic
set
- Set to true
to enable the stroke in your
customized graphic object.isStrokeOn()
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 IlvGraphic
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.