|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsm.SMShape
sm.SMText
A text shape for use with an Canvas
.
The text is drawn according to the fill paint and the text font1.
If the shape is outlined, the bounding box of the text is drawn according to the outline paint and stroke.
Field Summary |
Fields inherited from class sm.SMShape |
cptId |
Constructor Summary | |
SMText(java.awt.geom.Point2D loc,
java.awt.Paint p,
java.awt.Paint o,
java.lang.String txt,
java.awt.Font f)
Builds a SMtext. |
|
SMText(java.awt.geom.Point2D loc,
java.awt.Paint p,
java.awt.Paint o,
java.awt.Stroke str,
java.lang.String txt,
java.awt.Font f)
Builds a SMtext. |
|
SMText(java.awt.geom.Point2D loc,
java.awt.Paint p,
java.lang.String txt,
java.awt.Font f)
Builds a SMtext. |
|
SMText(java.awt.geom.Point2D loc,
java.awt.Paint p,
java.awt.Stroke str,
java.lang.String txt,
java.awt.Font f)
Builds a SMtext. |
|
SMText(java.awt.geom.Point2D loc,
java.lang.String txt,
java.awt.Font f)
Builds a SMtext. |
|
SMText(java.awt.geom.Point2D loc,
java.awt.Stroke str,
java.lang.String txt,
java.awt.Font f)
Builds a SMtext. |
Method Summary | |
SMShape |
addTo(SMCanvas c)
Adds this shape to a canvas. |
SMShape |
copyTo(SMShape sms)
Copies this shape into a destination shape. |
SMShape |
duplicate()
Creates a new copy of this shape and returns it. |
SMEllipse |
getAbsoluteEllipse(double w,
double h)
Returns a SMEllipse that surrounds this text.
|
SMRectangle |
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 |
SMEllipse |
getEllipticalBoundingBox()
Returns a SMEllipse filled in white that surrounds this SMText. |
java.awt.Font |
getFont()
Returns the text font1. |
SMEllipse |
getRelativeEllipse(double ratioX,
double ratioY)
Returns a SMEllipse that surrounds this text.
|
SMRectangle |
getRelativeRectangle(double ratioX,
double ratioY)
Returns a SMRectangle that surrounds this text.
|
java.lang.String |
getText()
Returns the text. |
double |
getX()
Returns the x coordinate of the text. |
double |
getY()
Returns the y coordinate of the text. |
void |
paint(java.awt.Graphics g)
Paints the shape. |
SMText |
setFont(java.awt.Font f)
Sets the text font1. |
SMText |
setLocation(java.awt.geom.Point2D loc)
Sets the location of the text. |
SMText |
setText(java.lang.String text)
Sets the text to be displayed. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SMText(java.awt.geom.Point2D loc, java.lang.String txt, java.awt.Font f)
loc
- The lower left point of this SMText.txt
- The text of this SMText.f
- The font1 of this SMText.public SMText(java.awt.geom.Point2D loc, java.awt.Paint p, java.awt.Paint o, java.awt.Stroke str, java.lang.String txt, java.awt.Font f)
loc
- The lower left point of this SMText.p
- The paint style of this SMText.o
- The paint style of the bounding box of this SMText.str
- The stroke style the bounding box of this SMText.txt
- The text of this SMText.f
- The font1 of this SMText.public SMText(java.awt.geom.Point2D loc, java.awt.Paint p, java.awt.Paint o, java.lang.String txt, java.awt.Font f)
loc
- The lower left point of this SMText.p
- The paint style of this SMText.o
- The paint style of the bounding box of this SMText.txt
- The text of this SMText.f
- The font1 of this SMText.public SMText(java.awt.geom.Point2D loc, java.awt.Paint p, java.awt.Stroke str, java.lang.String txt, java.awt.Font f)
loc
- The lower left point of this SMText.p
- The paint style of this SMText.str
- The stroke style the bounding box of this SMText.txt
- The text of this SMText.f
- The font1 of this SMText.public SMText(java.awt.geom.Point2D loc, java.awt.Paint p, java.lang.String txt, java.awt.Font f)
loc
- The lower left point of this SMText.p
- The paint style of this SMText.txt
- The text of this SMText.f
- The font1 of this SMText.public SMText(java.awt.geom.Point2D loc, java.awt.Stroke str, java.lang.String txt, java.awt.Font f)
loc
- The lower left point of this SMText.str
- The stroke style the bounding box of this SMText.txt
- The text of this SMText.f
- The font1 of this SMText.Method Detail |
public SMShape addTo(SMCanvas c)
SMShape
addTo
in class SMShape
c
- The canvas.
public void paint(java.awt.Graphics g)
SMShape
paint
in class SMShape
g
- The graphics with which the shape must be painted.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 SMRectangle getRelativeRectangle(double ratioX, double ratioY)
SMRectangle
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 SMEllipse getRelativeEllipse(double ratioX, double ratioY)
SMEllipse
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 SMRectangle 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 SMEllipse getAbsoluteEllipse(double w, double h)
SMEllipse
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 SMText setText(java.lang.String text)
text
- The text to set.
public SMEllipse getEllipticalBoundingBox()
public double getX()
public double getY()
public SMText setLocation(java.awt.geom.Point2D loc)
loc
- The new location of the text reference point.
public java.awt.Font getFont()
public SMText setFont(java.awt.Font f)
f
- The font1.
public SMShape copyTo(SMShape sms)
copyTo
in class SMShape
sms
- The destination shape
SMShape.copyTo(sm.SMShape)
public SMShape duplicate()
duplicate
in class SMShape
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |