Class TextNode
java.lang.Object
com.codename1.art.ArtNode
com.codename1.art.TextNode
Styled text. The first line's baseline starts at
x, y; with a box width set, lines wrap
at that width and align within it.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLines are centered on the box (or onxwith no box).static final intLines start atx.static final intLines end at the box's right edge (or atxwith no box). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()A deep copy.intgetAlign()One of theALIGN_constants.doubleThe wrapping width, or 0 for none.floatLine height as a multiple of the font size.double[]The bounds of this node's own content in its own space asx, y, w, h, without effects; null when it has none.getRuns()The runs.getText()All the characters of every run.doublegetX()Baseline origin x.doublegetY()Baseline origin y.voidsetAlign(int align) Sets the alignment.voidsetBoxWidth(double boxWidth) Sets the wrapping width.voidsetLineHeight(float lineHeight) Sets the line height.voidsetPosition(double x, double y) Sets the baseline origin.Methods inherited from class ArtNode
copyBase, getAttribute, getAttributes, getBlendMode, getBounds, getClipPath, getEffects, getId, getMask, getName, getOpacity, getTransform, isKnockout, isLocked, isLuminanceMask, isVisible, setAttribute, setBlendMode, setClipPath, setId, setKnockout, setLocked, setMask, setName, setOpacity, setTransform, setVisible
-
Field Details
-
ALIGN_LEFT
public static final int ALIGN_LEFTLines start atx.- See Also:
-
ALIGN_CENTER
public static final int ALIGN_CENTERLines are centered on the box (or onxwith no box).- See Also:
-
ALIGN_RIGHT
public static final int ALIGN_RIGHTLines end at the box's right edge (or atxwith no box).- See Also:
-
-
Constructor Details
-
TextNode
public TextNode()Creates an empty text node at the origin. -
TextNode
Creates a text node with one run.
Parameters
text: the characterssize: the font sizecolor: the color as0xAARRGGBB
-
-
Method Details
-
getRuns
-
getText
All the characters of every run. -
getX
public double getX()Baseline origin x. -
getY
public double getY()Baseline origin y. -
setPosition
public void setPosition(double x, double y) Sets the baseline origin.
Parameters
x: xy: y of the first baseline
-
getBoxWidth
public double getBoxWidth()The wrapping width, or 0 for none. -
setBoxWidth
public void setBoxWidth(double boxWidth) Sets the wrapping width.
Parameters
boxWidth: the width; 0 for no wrapping
-
getAlign
public int getAlign()One of theALIGN_constants. -
setAlign
public void setAlign(int align) Sets the alignment.
Parameters
align: one of theALIGN_constants
-
getLineHeight
public float getLineHeight()Line height as a multiple of the font size. -
setLineHeight
public void setLineHeight(float lineHeight) Sets the line height.
Parameters
lineHeight: a multiple of the font size
-
getLocalBounds
public double[] getLocalBounds()Description copied from class:ArtNodeThe bounds of this node's own content in its own space asx, y, w, h, without effects; null when it has none.- Specified by:
getLocalBoundsin classArtNode
-
copy
-