All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.font.StyledString

java.lang.Object
    |
    +----java.awt.font.StyledString

public class StyledString
extends Object
This class encapsulates information needed to draw text. It simplifies drawing text strings with multiple Fonts and languages. It performs layout of glyphs representing text strings with multiple Fonts, including bi-directional layout for mixed languages.

See Also:
drawString

Variable Index

 o attrs

Constructor Index

 o StyledString()
Constructs a new StyledString with no characters.
 o StyledString(String, AttributeSet)
 o StyledString(String, Font)
Constructs a new StyledString from the given String using the given Font.

Method Index

 o charAt(int)
Returns the character at the specified index.
 o concat(StyledString)
Concatenates the specified StyledString to the end of this StyledString and returns a new StyledString object representing the concatenation.
 o createIterator()
 o createIterator(int, int, int)
 o getAdvanceVector()
Returns the advance vector for the end position of this StyledString.
 o getAscent()
Returns the largest ascent of any font represented in this StyledString.
 o getAttributes(int)
 o getAttributesAt(int)
 o getBounds2D()
Returns the bounding box of this StyledString.
 o getChars()
 o getChars(int, int, char[], int)
Copies characters from this string into the destination character array.
 o getDescent()
Returns the largest descent of any font represented in this StyledString.
 o getFontAt(int)
Returns the Font associated with the character at the specified index.
 o getGlyphSets()
Returns an array of GlyphSet objects associated with this StyledString.
 o getLeading()
Returns the largest leading of any font represented in this StyledString.
 o getRunLimit(int)
 o getRunStart(int)
 o getStringOutline()
Returns the Shape object for this StyledString, which is the union of all the outlines for glyphs in the StyledString.
 o length()
Returns the length of the StyledString.
 o substring(int, int)
Creates a StyledString object that is a substring of this StyledString.
 o toString()
Generates a String representation of the StyledString.

Variables

 o attrs
public AttributeSet[] attrs

Constructors

 o StyledString
public StyledString()
Constructs a new StyledString with no characters.

 o StyledString
public StyledString(String str,
                    AttributeSet attributes)
 o StyledString
public StyledString(String str,
                    Font font)
Constructs a new StyledString from the given String using the given Font.

Parameters:
str - the String object.
font - the Font object.

Methods

 o substring
public StyledString substring(int beginIndex,
                              int endIndex)
Creates a StyledString object that is a substring of this StyledString. The substring is specified by a beginIndex (inclusive) and an endIndex (exclusive).

Parameters:
beginIndex - the beginning character index (inclusive) for the substring.
endIndex - the ending character index (exclusive) for the substring.
Throws: StringIndexOutOfBoundsException
if the beginIndex or the endIndex is out of range, or if the beginIndex is greater than the endIndex.
 o getAscent
public float getAscent()
Returns the largest ascent of any font represented in this StyledString. The units are user space coordinates.

 o getDescent
public float getDescent()
Returns the largest descent of any font represented in this StyledString. The units are user space coordinates.

 o getLeading
public float getLeading()
Returns the largest leading of any font represented in this StyledString. The units are user space coordinates.

 o getAttributes
public AttributeSet getAttributes(int index)
 o getRunStart
public int getRunStart(int index)
 o getRunLimit
public int getRunLimit(int index)
 o getAdvanceVector
public Point2D getAdvanceVector()
Returns the advance vector for the end position of this StyledString.

 o getBounds2D
public Rectangle2D getBounds2D()
Returns the bounding box of this StyledString.

 o getGlyphSets
public GlyphSet[] getGlyphSets()
Returns an array of GlyphSet objects associated with this StyledString.

 o getStringOutline
public Shape getStringOutline()
Returns the Shape object for this StyledString, which is the union of all the outlines for glyphs in the StyledString.

 o toString
public String toString()
Generates a String representation of the StyledString.

Overrides:
toString in class Object
 o concat
public StyledString concat(StyledString str)
Concatenates the specified StyledString to the end of this StyledString and returns a new StyledString object representing the concatenation.

 o charAt
public char charAt(int index)
Returns the character at the specified index. An index ranges from 0 to length() - 1.

Throws: StringIndexOutOfBoundsException
if the index is not in the range 0 to length()-1.
 o getFontAt
public Font getFontAt(int index)
Returns the Font associated with the character at the specified index. An index ranges from 0 to length() - 1.

Throws: StringIndexOutOfBoundsException
if the index is not in the range 0 to length()-1.
 o length
public int length()
Returns the length of the StyledString. The length of the StyledString is equal to the number of 16-bit Unicode characters in the String.

 o createIterator
public AttributedCharacterIterator createIterator()
 o createIterator
public AttributedCharacterIterator createIterator(int start,
                                                  int limit,
                                                  int pos)
 o getAttributesAt
public AttributeSet getAttributesAt(int index)
 o getChars
public void getChars(int srcBegin,
                     int srcEnd,
                     char[] dst,
                     int dstBegin)
Copies characters from this string into the destination character array.

The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1 (thus the total number of characters to be copied is srcEnd-srcBegin). The characters are copied into the subarray of dst starting at index dstBegin and ending at index:

     dstbegin + (srcEnd-srcBegin) - 1
 

Parameters:
srcBegin - index of the first character in the string to copy.
srcEnd - index after the last character in the string to copy.
dst - the destination array.
dstBegin - the start offset in the destination array.
Throws: StringIndexOutOfBoundsException
If srcBegin or srcEnd is out of range, or if srcBegin is greater than the srcEnd.
 o getChars
public char[] getChars()

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature