API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt.font. TextLayout View Source
Author(s)
Since
Version
Serial
Hierarchy
 Object
      TextLayout
Implements
 Cloneable
Subclasses
Description
publicfinal class TextLayout
  TextLayout is an immutable graphical representation of styled character data.
Constructors
public TextLayout (AttributedCharacterIterator text, FontRenderContext frc)
  Constructs a TextLayout from an iterator over styled text.
public TextLayout (String string, Font font, FontRenderContext frc)
  Constructs a TextLayout from a String and a Font.
public TextLayout (String string, Map<Attribute, Object> attributes, FontRenderContext frc)
  Constructs a TextLayout from a String and an attribute set.
pack-private TextLayout (TextLine textLine, byte baseline, float[] baselineOffsets, float justifyRatio)
  Creates a TextLayout from a TextLine and some paragraph data.
Methods
Hide/Show inherited methods
protected Object clone ()
Creates a copy of this TextLayout.
public void draw (Graphics2D g2, float x, float y)
  Renders this TextLayout at the specified location in the specified Graphics2D context.
public boolean equals (Object obj)
  Returns true if the specified Object is a TextLayout object and if the specified Object equals this TextLayout.
public boolean equals (TextLayout rhs)
  Returns true if the two layouts are equal.
public float getAdvance ()
  Returns the advance of this TextLayout.
public float getAscent ()
  Returns the ascent of this TextLayout.
public byte getBaseline ()
  Returns the baseline for this TextLayout.
pack-privatestatic byte getBaselineFromGraphic (GraphicAttribute graphic)
public float getBaselineOffsets ()
  Returns the offsets array for the baselines used for this TextLayout.
public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
  Returns the black box bounds of the characters in the specified range.
public Rectangle2D getBounds ()
  Returns the bounds of this TextLayout.
public float getCaretInfo (TextHitInfo hit)
  Returns information about the caret corresponding to hit.
public float getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
  Returns information about the caret corresponding to hit.
public Shape getCaretShape (TextHitInfo hit)
  Returns a Shape representing the caret at the specified hit inside the natural bounds of this TextLayout.
public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
  Returns a Shape representing the caret at the specified hit inside the specified bounds.
public Shape getCaretShapes (int offset)
  Returns two paths corresponding to the strong and weak caret.
public Shape getCaretShapes (int offset, Rectangle2D bounds)
  Returns two paths corresponding to the strong and weak caret.
public Shape getCaretShapes (int offset, Rectangle2D bounds, CaretPolicy policy)
  Returns two paths corresponding to the strong and weak caret.
public int getCharacterCount ()
  Returns the number of characters represented by this TextLayout.
public byte getCharacterLevel (int index)
  Returns the level of the character at index.
public float getDescent ()
  Returns the descent of this TextLayout.
public TextLayout getJustifiedLayout (float justificationWidth)
  Creates a copy of this TextLayout justified to the specified width.
public LayoutPath getLayoutPath ()
  Return the LayoutPath, or null if the layout path is the default path (x maps to advance, y maps to offset).
public float getLeading ()
  Returns the leading of the TextLayout.
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint)
  Returns a Shape enclosing the logical selection in the specified range, extended to the natural bounds of this TextLayout.
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint, Rectangle2D bounds)
  Returns a Shape enclosing the logical selection in the specified range, extended to the specified bounds.
public int getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
  Returns the logical ranges of text corresponding to a visual selection.
public TextHitInfo getNextLeftHit (int offset)
  Returns the hit for the next caret to the left (top); if no such hit, returns null.
public TextHitInfo getNextLeftHit (int offset, CaretPolicy policy)
  Returns the hit for the next caret to the left (top); if no such hit, returns null.
public TextHitInfo getNextLeftHit (TextHitInfo hit)
  Returns the hit for the next caret to the left (top); if no such hit, returns null.
public TextHitInfo getNextRightHit (int offset)
  Returns the hit for the next caret to the right (bottom); if no such hit, returns null.
public TextHitInfo getNextRightHit (int offset, CaretPolicy policy)
  Returns the hit for the next caret to the right (bottom); if no such hit, returns null.
public TextHitInfo getNextRightHit (TextHitInfo hit)
  Returns the hit for the next caret to the right (bottom); if there is no such hit, returns null.
public Shape getOutline (AffineTransform tx)
  Returns a Shape representing the outline of this TextLayout.
public Rectangle getPixelBounds (FontRenderContext frc, float x, float y)
  Returns the pixel bounds of this TextLayout when rendered in a graphics with the given FontRenderContext at the given location.
pack-private TextLine getTextLineForTesting ()
  Package-only method for testing ONLY.
public float getVisibleAdvance ()
  Returns the advance of this TextLayout, minus trailing whitespace.
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
  Returns a Shape enclosing the visual selection in the specified range, extended to the bounds.
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint, TextHitInfo secondEndpoint, Rectangle2D bounds)
  Returns a path enclosing the visual selection in the specified range, extended to bounds.
public TextHitInfo getVisualOtherHit (TextHitInfo hit)
  Returns the hit on the opposite side of the specified hit's caret.
protected void handleJustify (float justificationWidth)
  Justify this layout.
public int hashCode ()
  Returns the hash code of this TextLayout.
public TextHitInfo hitTestChar (float x, float y)
  Returns a TextHitInfo corresponding to the specified point.
public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
  Returns a TextHitInfo corresponding to the specified point.
public void hitToPoint (TextHitInfo hit, Point2D point)
  Convert a hit to a point in standard coordinates.
public boolean isLeftToRight ()
  Returns true if this TextLayout has a left-to-right base direction or false if it has a right-to-left base direction.
public boolean isVertical ()
  Returns true if this TextLayout is vertical.
public String toString ()
  Returns debugging information for this TextLayout.
Fields
Hide/Show inherited fields
publicfinalstatic CaretPolicy DEFAULT_CARET_POLICY
  This CaretPolicy is used when a policy is not specified by the client.
Nested Classes
  TextLayout.CaretPolicy
Defines a policy for determining the strong caret location.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar