|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.IlvGraphic
ilog.views.graphic.IlvRectangle
ilog.views.graphic.IlvReliefRectangle
ilog.views.graphic.IlvReliefLabel
public class IlvReliefLabel
IlvReliefLabel represents a labeled rectangle in relief with
customizable fill and text colors.
The default values for an IlvReliefLabel instance are as
follows:
Color.blackColor.blackIlvRect(0, 0, 100, 100)2IlvToolkit.defaultFontNote: 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 IlvReliefLabel in a
simple Java application:
IlvManager manager = new IlvManager();
IlvReliefLabel myDefaultRect = new IlvReliefLabel();
myDefaultRect.setLabel("Default Relief Label");
IlvReliefLabel myCustomRect = new IlvReliefLabel(
new IlvRect(120,100,80,20),
"Custom Relief Label",
6);
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:
>
IlvReliefLabel 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,
Serialized Form| Field Summary |
|---|
| Fields inherited from class ilog.views.graphic.IlvRectangle |
|---|
BOTTOM_LEFT, BOTTOM_RIGHT, drawrect, TOP_LEFT, TOP_RIGHT |
| Constructor Summary | |
|---|---|
IlvReliefLabel()
Creates a new IlvReliefLabel with default size of
(0, 0, 100, 100) and an empty label. |
|
IlvReliefLabel(IlvInputStream stream)
Reads the object from an IlvInputStream. |
|
IlvReliefLabel(IlvPoint at,
String label,
int thickness)
Creates a new IlvReliefLabel. |
|
IlvReliefLabel(IlvRect rect,
String label)
Creates a new IlvReliefLabel. |
|
IlvReliefLabel(IlvRect rect,
String label,
int thickness)
Creates a new IlvReliefLabel. |
|
IlvReliefLabel(IlvReliefLabel source)
Creates a new IlvReliefLabel by copying an existing one. |
|
| Method Summary | |
|---|---|
IlvGraphic |
copy()
Copies the object. |
protected void |
drawContent(Graphics dst,
IlvRect rect,
IlvTransformer t)
Draws the inner part of the object. |
void |
drawLabel(Graphics dst,
IlvRect rect,
IlvTransformer t)
Draws the label inside the relief rectangle. |
void |
fitToLabel()
Recomputes the size of the object according to the current label and thickness. |
Font |
getFont()
Returns the font of the object. |
String |
getLabel()
Returns the label of the object. |
IlvRect |
getLabelBBox(IlvTransformer t)
Returns the bounding area where the label is displayed. |
boolean |
isAntialiasing()
Returns true if the anti-aliasing mode
of the label is on. |
void |
setAntialiasing(boolean set)
Changes the anti-aliasing mode of the label. |
void |
setFont(Font font)
Changes the font of the object. |
void |
setLabel(String label)
Changes the label of the object. |
boolean |
supportMultiline()
Returns false
since this object does not support multiline text. |
String |
toString()
Returns a string representation of the graphic object. |
void |
write(IlvOutputStream stream)
Writes the object to an IlvOutputStream. |
| Methods inherited from class ilog.views.graphic.IlvReliefRectangle |
|---|
draw, getThickness, setCorners, setFillOn, setRadius, setStrokeOn, setThickness |
| Methods inherited from class ilog.views.graphic.IlvRectangle |
|---|
applyTransform, boundingBox, contains, getBackground, getCorners, getDefinitionRect, getForeground, getIntersectionWithOutline, getRadius, isCornersZoomable, isFillOn, isStrokeOn, moveResize, setBackground, setCornersZoomable, setDefinitionRect, setForeground, translate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IlvReliefLabel()
IlvReliefLabel with default size of
(0, 0, 100, 100) and an empty label.
IlvReliefLabel(IlvRect, String)
public IlvReliefLabel(IlvRect rect,
String label)
IlvReliefLabel.
rect - The definition rectangle of the object.label - The label.
public IlvReliefLabel(IlvRect rect,
String label,
int thickness)
IlvReliefLabel.
rect - The definition rectangle of the object.label - The label.thickness - The thickness of the relief.
public IlvReliefLabel(IlvPoint at,
String label,
int thickness)
IlvReliefLabel.
The size of the object is determined by the label.
at - The upper-left point of the object.label - The label.thickness - The thickness of the relief.public IlvReliefLabel(IlvReliefLabel source)
IlvReliefLabel by copying an existing one.
source - The origin object for the copy.
public IlvReliefLabel(IlvInputStream stream)
throws IlvReadFileException
IlvInputStream.
stream - The input stream.
IlvReadFileException - if the format is not correct.| Method Detail |
|---|
public final void setLabel(String label)
setLabel in interface IlvLabelInterfacelabel - The new label.fitToLabel()public void fitToLabel()
The width of the definition rectangle is set to the width of the current label plus 4 times the current thickness. The height of the definition rectangle is set to the height of the current label plus 4 times the current thickness. The upper-left corner of the definition rectangle is not moved.
If the current label is null, the width and height
of the definition rectangle are set to the value 10.
Note that if the object is contained inside a manager, you should call
this method using the method IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean).
getLabel(),
IlvReliefRectangle.getThickness()public final String getLabel()
getLabel in interface IlvLabelInterfacepublic boolean supportMultiline()
false
since this object does not support multiline text.
supportMultiline in interface IlvLabelInterfacepublic IlvRect getLabelBBox(IlvTransformer t)
getLabelBBox in interface IlvLabelInterfacet - The transformer used to draw the object.public final void setFont(Font font)
setFont in interface IlvFontInterfacefont - The new font.public final Font getFont()
getFont in interface IlvFontInterfacepublic final boolean isAntialiasing()
true if the anti-aliasing mode
of the label is on.
public final void setAntialiasing(boolean set)
public IlvGraphic copy()
copy in class IlvReliefRectangleIlvGraphic
protected void drawContent(Graphics dst,
IlvRect rect,
IlvTransformer t)
drawContent of IlvReliefRectangle to
draw the label of the object.
drawContent in class IlvReliefRectangledst - 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 void drawLabel(Graphics dst,
IlvRect rect,
IlvTransformer t)
dst - The destination Graphics.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 transformation used to draw the object.
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 IlvPersistentObjectwrite in class IlvReliefRectanglestream - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.public String toString()
IlvGraphic.toString() with the label
(see getLabel()).
toString in class IlvGraphicIlvGraphic.getName()
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||