public class TextLayout
extends java.lang.Object
implements java.lang.AutoCloseable
Constructor and Description |
---|
TextLayout(java.awt.Graphics2D g2d,
java.awt.Font font)
Initializes a new instance of the TextLayout class.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
draw(java.awt.Graphics2D g2d,
java.awt.Font font,
java.awt.Color color,
java.awt.geom.Rectangle2D.Float bounds,
boolean drawSelection,
int selectionStart,
int selectionLength,
java.awt.Color selectionColor,
boolean drawCaret,
int firstLine) |
int |
getCharacterIndexFromPoint(java.awt.geom.Rectangle2D.Float bounds,
java.awt.geom.Point2D position,
int firstLine)
Retrieves the character at the specified position.
|
java.awt.geom.Rectangle2D.Float |
getCharBounds(int characterIndex,
java.awt.geom.Rectangle2D.Float bounds)
Gets the bounding rectangle of the character with the specified index.
|
XDimension2D.Double |
getDesiredSize(XDimension2D.Double availableSize,
java.awt.Graphics2D g2d) |
int |
getEndOfLine(java.awt.geom.Rectangle2D.Float bounds,
int lineIndex)
Retrieves the index of the last character of the specified line.
|
float |
getFontHeight()
Gets the height of the underlying font.
|
int |
getLineCount(java.awt.geom.Rectangle2D.Float bounds)
Returns the number of lines in the layout.
|
int |
getLineFromCharacterIndex(java.awt.geom.Rectangle2D.Float bounds,
int characterIndex)
Retrieves the line containing the character with the specified index.
|
int |
getRelativeCharacterIndex(java.awt.geom.Rectangle2D.Float bounds,
int characterIndex,
boolean up)
Gets the index of the character, corresponding to the position of the specified
character from the line above or the line below the line containing the character.
|
int |
getStartOfLine(java.awt.geom.Rectangle2D.Float bounds,
int lineIndex)
Retrieves the index of the first character of the specified line.
|
java.lang.String |
getText() |
TextWrapping |
getTextWrapping() |
void |
invalidate()
Invalidates the text layout.
|
void |
setText(java.lang.String value) |
void |
setTextWrapping(TextWrapping value) |
public TextLayout(java.awt.Graphics2D g2d, java.awt.Font font)
public void close()
close
in interface java.lang.AutoCloseable
public void invalidate()
public int getLineFromCharacterIndex(java.awt.geom.Rectangle2D.Float bounds, int characterIndex)
public int getRelativeCharacterIndex(java.awt.geom.Rectangle2D.Float bounds, int characterIndex, boolean up)
public int getEndOfLine(java.awt.geom.Rectangle2D.Float bounds, int lineIndex)
public int getStartOfLine(java.awt.geom.Rectangle2D.Float bounds, int lineIndex)
public int getCharacterIndexFromPoint(java.awt.geom.Rectangle2D.Float bounds, java.awt.geom.Point2D position, int firstLine)
public int getLineCount(java.awt.geom.Rectangle2D.Float bounds)
public void draw(java.awt.Graphics2D g2d, java.awt.Font font, java.awt.Color color, java.awt.geom.Rectangle2D.Float bounds, boolean drawSelection, int selectionStart, int selectionLength, java.awt.Color selectionColor, boolean drawCaret, int firstLine)
public float getFontHeight()
public java.awt.geom.Rectangle2D.Float getCharBounds(int characterIndex, java.awt.geom.Rectangle2D.Float bounds)
public XDimension2D.Double getDesiredSize(XDimension2D.Double availableSize, java.awt.Graphics2D g2d)
public TextWrapping getTextWrapping()
public void setTextWrapping(TextWrapping value)
public java.lang.String getText()
public void setText(java.lang.String value)