public class CText extends CShape
Canvas.
 The text is drawn according to the fill paint and the text font.
 If the shape is outlined, the bounding box of the text is drawn according to the outline paint and stroke.| Modifier and Type | Field and Description | 
|---|---|
static java.awt.font.FontRenderContext | 
FRC
The FontRenderContext used to render this text. 
 | 
| Constructor and Description | 
|---|
CText(java.awt.geom.Point2D loc,
     java.lang.String txt,
     java.awt.Font f)
Builds a SMtext. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
CShape | 
copyTo(CShape sms)
Copies this shape into a destination shape. 
 | 
CShape | 
duplicate()
Creates a new copy of this shape and returns it. 
 | 
CEllipse | 
getAbsoluteEllipse(double w,
                  double h)
Returns a  
CEllipse that surrounds this text. | 
CRectangle | 
getAbsoluteRectangle(double w,
                    double h)
Returns a  
CRectangle that surrounds this text. | 
char | 
getChar(double x,
       double y)
Returns the nearest char from the location  
(x, y). | 
char | 
getChar(java.awt.geom.Point2D p)
Returns the nearest char from the point  
p. | 
java.awt.Font | 
getFont()
Returns the text font. 
 | 
CEllipse | 
getRelativeEllipse(double ratioX,
                  double ratioY)
Returns a  
CEllipse that surrounds this text. | 
CRectangle | 
getRelativeRectangle(double ratioX,
                    double ratioY)
Returns a  
CRectangle that surrounds this text. | 
java.lang.String | 
getText()
Returns the text. 
 | 
void | 
paint(java.awt.Graphics g)
Paints the shape. 
 | 
CElement | 
setAntialiased(boolean a)
Specifies whether this shape is antialiased. 
 | 
CText | 
setFont(java.awt.Font f)
Sets the text font. 
 | 
CText | 
setReferencePointToBaseline()
Sets the reference point of this  
CText
 to its baseline. | 
CText | 
setText(java.lang.String text)
Sets the text to be displayed. 
 | 
above, aboveAll, addChild, addGhost, addTag, addTag, addTag, addTo, animate, asEllipse, asImage, asPolyLine, asRectangle, asRectangularShape, asText, attachSM, below, belowAll, canvasToShape, canvasToShapeRef, clone, contains, contains, contains, contains, detachSM, duplicateWithTags, firstShape, fixReferenceShapeToCurrent, getAbsShape, getAbsTransform, getAntialiasedShapes, getBoundingBox, getCanvas, getCenterX, getCenterY, getChild, getChildren, getChildrenCount, getClip, getFilledShapes, getFillPaint, getFirstAntialiasedShape, getFirstFilledShape, getFirstHavingTag, getFirstOutlinedShape, getGhost, getHeight, getHierarchy, getIntersection, getMaxX, getMaxY, getMinX, getMinY, getOutlinedShapes, getOutlinePaint, getParent, getReferenceX, getReferenceY, getRenderingHint, getRotation, getScaleX, getScaleY, getShape, getStroke, getSubtraction, getTags, getTransform, getTranslateX, getTranslateY, getTransparencyFill, getTransparencyOutline, getWidth, hasTag, hasTag, indexOf, intersects, isAbove, isAntialiased, isBelow, isDrawable, isFilled, isOnOutline, isOutlined, isPickable, isPicked, pick, pickStyle, remove, removeAllChildren, removeChild, removeChild, removeGhost, removeTag, removeTag, rotateBy, rotateTo, scaleBy, scaleBy, scaleTo, scaleTo, setClip, setDrawable, setFilled, setFillPaint, setOutlined, setOutlinePaint, setParent, setPickable, setReferencePoint, setReferencePoint, setRenderingHint, setShape, setStroke, setTransformToIdentity, setTransparencyFill, setTransparencyFill, setTransparencyOutline, setTransparencyOutline, shapeToCanvas, translateBy, translateTopublic static java.awt.font.FontRenderContext FRC
public CText(java.awt.geom.Point2D loc,
     java.lang.String txt,
     java.awt.Font f)
loc - The lower left point of this CText.txt - The text of this CText.f - The font of this CText.public void paint(java.awt.Graphics g)
public char getChar(double x,
           double y)
(x, y).x - The x-coordinate (in the canvas coordinate system)y - The y-coordinate (in the canvas coordinate system)public char getChar(java.awt.geom.Point2D p)
p.p - The pont (in the canvas coordinate system)public CRectangle getRelativeRectangle(double ratioX, double ratioY)
CRectangle that surrounds this text. 
 If the bounding box of the text is a box whose width and height are respectively w and h,
 the result rectangle is centered at the center of the text and has a width ratioX*w and a height ratioY*h.
 This method does NOT add the built CRectangle to the canvas.ratioX - The width ratio.ratioY - The height ratio.public CEllipse getRelativeEllipse(double ratioX, double ratioY)
CEllipse that surrounds this text. 
 If the bounding box of the text is a box whose width and height are respectively w and h,
 the result ellipse is centered at the center of the text and has a width ratioX*w and a height ratioY*h.
 This method does NOT add the built CRectangle to the canvas.ratioX - The width ratio.ratioY - The height ratio.public CRectangle getAbsoluteRectangle(double w, double h)
CRectangle that surrounds this text. 
 The result rectangle is centered at the center of the text and has a width w and a height h.
 This method does NOT add the built CRectangle to the canvas.w - The width ratio.h - The height ratio.public CEllipse getAbsoluteEllipse(double w, double h)
CEllipse that surrounds this text. 
 The result ellipse is centered at the center of the text and has a width w and a height h.
 This method does NOT add the built CRectangle to the canvas.w - The width ratio.h - The height ratio.public java.lang.String getText()
public CText setReferencePointToBaseline()
CText
 to its baseline.
 
 
 By default, the position of a CText specifies
 the upper left corner of its bounding box. For example, the
 following lines makes the two CText be displayed
 below the segment [(10, 20), (50, 20)]: 
 
CText text1 = canvas.newText(10, 20, "ab"); CText text2 = canvas.newText(30, 20, "pc"); canvas.newSegment(10, 20, 50, 20);This can be an issue for setting the position of a
CText 
 according to its baseline.
 Setting the reference point of a CText to its
 baseline allows to overcome this problem:
 text1.setReferencePointToBaseline().translateTo(10, 20); text2.setReferencePointToBaseline().translateTo(30, 20);text1 and text2 appear as if they were written on the same virtual line positioned at y=20.
CText.public CText setText(java.lang.String text)
text - The text to set.public java.awt.Font getFont()
public CText setFont(java.awt.Font f)
f - The font.public CShape copyTo(CShape sms)
copyTo in class CShapesms - The destination shapeCShape.copyTo(fr.lri.swingstates.canvas.CShape)public CShape duplicate()
duplicate in class CShapeCShape.duplicateWithTags()public CElement setAntialiased(boolean a)
setAntialiased in interface CElementsetAntialiased in class CShapea - True if this shape is to be antialiased.CShape.setAntialiased(boolean)