public class TextNode extends AbstractGraphicsNode implements Selectable
| Modifier and Type | Class and Description |
|---|---|
static class |
TextNode.Anchor
Defines where the text of a
TextNode can be anchored
relative to its location. |
| Modifier and Type | Field and Description |
|---|---|
protected AttributedCharacterIterator |
aci
Attributed Character Iterator describing the text
|
protected Mark |
beginMark
The begin mark.
|
protected Mark |
endMark
The end mark.
|
protected Point2D |
location
Location of this text node (inherited, independent of explicit
X and Y attributes applied to children).
|
static AttributedCharacterIterator.Attribute |
PAINT_INFO |
protected String |
text
The text of this
TextNode. |
protected TextPainter |
textPainter
The text painter used to display the text of this text node.
|
protected List |
textRuns
The list of text runs.
|
changeCompletedEvent, changeStartedEvent, clip, composite, enableBackgroundGraphicsNodeRable, filter, graphicsNodeRable, hints, inverseTransform, isVisible, listeners, mask, parent, pointerEventType, root, transform, weakRefALL, FILL, IDENTITY, NONE, PAINTED, STROKE, VISIBLE, VISIBLE_FILL, VISIBLE_PAINTED, VISIBLE_STROKE| Constructor and Description |
|---|
TextNode()
Constructs a new empty
TextNode. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Point2D p)
Returns true if the specified Point2D is inside the boundary of this
node, false otherwise.
|
protected boolean |
contains(Point2D p,
Rectangle2D b) |
AttributedCharacterIterator |
getAttributedCharacterIterator()
Returns the attributed character iterator of this text node.
|
Rectangle2D |
getGeometryBounds()
Returns the bounds of the area covered by this node, without
taking any of its rendering attribute into account.
|
Shape |
getHighlightShape()
Returns the shape used to outline this text node.
|
Point2D |
getLocation()
Returns the location of this text node.
|
Mark |
getMarkerForChar(int index,
boolean beforeChar)
Return the marker for the character at index in this nodes
AttributedCharacterIterator.
|
Shape |
getOutline()
Returns the outline of this node.
|
Rectangle2D |
getPrimitiveBounds()
Returns the bounds of the area covered by this node's primitive paint.
|
Object |
getSelection()
Gets the current text selection.
|
Rectangle2D |
getSensitiveBounds()
Returns the bounds of the sensitive area covered by this node,
This includes the stroked area but does not include the effects
of clipping, masking or filtering.
|
String |
getText()
Returns the text of this
TextNode as a string. |
TextPainter |
getTextPainter()
Returns the text painter of this text node.
|
List |
getTextRuns()
Returns a list of text runs.
|
protected void |
invalidateGeometryCache()
Invalidates this
TextNode. |
void |
primitivePaint(Graphics2D g2d)
Paints this node without applying Filter, Mask, Composite, and clip.
|
boolean |
selectAll(double x,
double y)
Selects all the text in this TextNode.
|
boolean |
selectAt(double x,
double y)
Initializes the current selection to begin with the character at (x, y).
|
boolean |
selectTo(double x,
double y)
Extends the current selection to the character at (x, y).
|
void |
setAttributedCharacterIterator(AttributedCharacterIterator newAci)
Sets the attributed character iterator of this text node.
|
void |
setLocation(Point2D newLocation)
Sets the location of this text node.
|
void |
setSelection(Mark begin,
Mark end) |
void |
setTextPainter(TextPainter textPainter)
Sets the text painter of this text node.
|
void |
setTextRuns(List textRuns)
Sets the list of text runs of this text node.
|
void |
swapTextPaintInfo(TextPaintInfo newInfo,
TextPaintInfo oldInfo) |
fireGraphicsNodeChangeCompleted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, getBounds, getClip, getComposite, getEnableBackgroundGraphicsNodeRable, getFilter, getGlobalTransform, getGraphicsNodeRable, getInverseTransform, getMask, getParent, getPointerEventType, getRenderingHints, getRoot, getTransform, getTransformedBounds, getTransformedGeometryBounds, getTransformedPrimitiveBounds, getTransformedSensitiveBounds, getWeakReference, intersects, isAntialiasedClip, isOffscreenBufferNeeded, isVisible, nodeHitAt, normalizeRectangle, paint, setClip, setComposite, setFilter, setMask, setParent, setPointerEventType, setRenderingHint, setRenderingHints, setRenderingHints, setRoot, setTransform, setVisiblepublic static final AttributedCharacterIterator.Attribute PAINT_INFO
protected Point2D location
protected AttributedCharacterIterator aci
protected String text
TextNode.protected Mark beginMark
protected Mark endMark
protected List textRuns
protected TextPainter textPainter
public void setTextPainter(TextPainter textPainter)
textPainter - the text painter to usepublic TextPainter getTextPainter()
public List getTextRuns()
public void setTextRuns(List textRuns)
textRuns - the new list of text runspublic String getText()
TextNode as a string.public void setLocation(Point2D newLocation)
newLocation - the new location of this text nodepublic Point2D getLocation()
public void swapTextPaintInfo(TextPaintInfo newInfo, TextPaintInfo oldInfo)
public void setAttributedCharacterIterator(AttributedCharacterIterator newAci)
newAci - the new attributed character iteratorpublic AttributedCharacterIterator getAttributedCharacterIterator()
protected void invalidateGeometryCache()
TextNode. This node and all its ancestors have
been informed that all its cached values related to its bounds must be
recomputed.invalidateGeometryCache in class AbstractGraphicsNodepublic Rectangle2D getPrimitiveBounds()
getPrimitiveBounds in interface GraphicsNodepublic Rectangle2D getGeometryBounds()
getGeometryBounds in interface GraphicsNodepublic Rectangle2D getSensitiveBounds()
getSensitiveBounds in interface GraphicsNodepublic Shape getOutline()
getOutline in interface GraphicsNodepublic Mark getMarkerForChar(int index, boolean beforeChar)
public boolean selectAt(double x,
double y)
selectAt in interface Selectablex - the x coordinate of the start of the selectiony - the y coordinate of the start of the selectionpublic boolean selectTo(double x,
double y)
selectTo in interface Selectablex - the x coordinate of the end of the selectiony - the y coordinate of the end of the selectionpublic boolean selectAll(double x,
double y)
selectAll in interface Selectablex - the x coordinate of the point the selection was madey - the y coordinate of the point the selection was madepublic Object getSelection()
getSelection in interface Selectablepublic Shape getHighlightShape()
getHighlightShape in interface Selectablepublic void primitivePaint(Graphics2D g2d)
primitivePaint in interface GraphicsNodeg2d - the Graphics2D to usepublic boolean contains(Point2D p)
contains in interface GraphicsNodecontains in class AbstractGraphicsNodep - the specified Point2D in the user spaceprotected boolean contains(Point2D p, Rectangle2D b)
Copyright © 2000–2017 Apache Software Foundation. All rights reserved.