All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.font.TextAttributeSet

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

public final class TextAttributeSet
extends Object
implements MutableAttributeSet, Serializable
TextAttributeSet defines attributes and values used by the text layout classes. It also provides a simple implementation of MutableAttributeSet.


Variable Index

 o BACKGROUND
The background color.
 o BASELINE
Baseline to which to align lines.
 o BASELINE_DEFAULT
The default baseline if BASELINE is unspecified.
 o BASELINE_HANGING
Use a hanging baseline for the line.
 o BASELINE_IDEOGRAPHIC
Use a center baseline for the line.
 o BASELINE_OFFSETS
Baseline offsets used by a line.
 o BASELINE_ROMAN
Use a roman baseline for the line.
 o BIDI_EMBEDDING
The embedding level for nested bidirectional runs.
 o BIDI_EMBEDDING_DEFAULT
The default embedding if BIDI_EMBEDDING is unspecified.
 o BIDI_NUMERIC
The bidirectional layout control for roman numeral text.
 o BIDI_NUMERIC_DEFAULT
 o BIDI_NUMERIC_STRONG_ARABIC
Interpret roman numerals as arabic numerals always.
 o BIDI_NUMERIC_STRONG_ROMAN
Interpret roman numerals as roman numerals always.
 o BIDI_NUMERIC_WEAK_ARABIC
Interpret roman numerals as having arabic line order.
 o EMPTY
An empty attribute set, for convenience.
 o FAMILY
The unlocalized font family name.
 o FAMILY_ALL
 o FONT
The font to use to render this text.
 o FOREGROUND
The foreground color.
 o INPUT_METHOD_SEGMENT
Constant for the attribute "input method segment".
 o JUSTIFICATION
Justification for the paragraph.
 o JUSTIFICATION_DEFAULT
The default justification if JUSTIFICATION is unspecified.
 o JUSTIFICATION_FULL
Justify the line to the full requested width.
 o JUSTIFICATION_NONE
Do not allow the line to be justified.
 o LANGUAGE
Constant for the attribute "language".
 o POSTURE
The posture of the font.
 o POSTURE_DEFAULT
The default posture if POSTURE is unspecified.
 o POSTURE_ITALIC
The standard italic posture for the font.
 o READING
Constant for the attribute "reading".
 o RUN_DIRECTION
The run direction of the line, either left-to-right or right-to-left.
 o RUN_DIRECTION_DEFAULT
The default direction if RUN_DIRECTION is unspecified.
 o RUN_DIRECTION_LTR
Left-to-right (top-to-bottom) run direction.
 o RUN_DIRECTION_RTL
Right-to-left (bottom-to-top) run direction.
 o SIZE
The font size in points.
 o STRIKETHROUGH
Adorn the text with strikethrough.
 o STRIKETHROUGH_DEFAULT
The default strikethrough if STRIKETHROUGH is unspecified, the value is false.
 o STRIKETHROUGH_ON
A single strikethrough.
 o SUPERSUBSCRIPT
Super and subscripting.
 o SUPERSUBSCRIPT_DEFAULT
The default supersubscript if SUPERSUBSCRIPT is unspecified.
 o SUPERSUBSCRIPT_DOWN1
Standard subscript.
 o SUPERSUBSCRIPT_UP1
Standard superscript.
 o SWAP_COLORS
Swap foreground and background colors (for input method use).
 o SWAP_COLORS_DEFAULT
Default to not swap foreground and background colors.
 o SWAP_COLORS_OFF
Do not swap foreground and background colors.
 o SWAP_COLORS_ON
Swap foreground and background colors.
 o TRANSFORM
The transform of the font.
 o UNDERLINE
Adorn the text with underlining.
 o UNDERLINE_LOW_DASHED
Single pixel dashed low underline.
 o UNDERLINE_LOW_DOTTED
Single pixel dotted low underline.
 o UNDERLINE_LOW_GRAY
Double pixel gray low underline.
 o UNDERLINE_LOW_ONE_PIXEL
Single pixel solid low underline.
 o UNDERLINE_LOW_TWO_PIXEL
Double pixel solid low underline.
 o UNDERLINE_OFF
No underline.
 o UNDERLINE_ON
Standard underline at the roman baseline for roman text, and below the decenders for other text.
 o WEIGHT
The weight of the font.
 o WEIGHT_BOLD
The bold weight for the font.
 o WEIGHT_DEFAULT
The default weight if WEIGHT is unspecified.
 o WEIGHT_LIGHT
The light weight for the font.

Constructor Index

 o TextAttributeSet()
Construct a new mutable attribute set.
 o TextAttributeSet(AttributeSet)
Construct a new mutable attribute set containing the provided attributes.
 o TextAttributeSet(String, Object)
Construct a new mutable attribute set containing the provided attribute.

Method Index

 o add(AttributeSet)
Remove any existing attributes with the same names, and add the new attributes.
 o add(String, Object)
Remove any existing attribute with the same name, and add a new attribute with the given name and value.
 o clone()
Return a copy of this attribute set.
 o contains(AttributeSet)
Returns true if this set contains all the attributes with equal values.
 o contains(String, Object)
Returns true if this set contains this attribute with an equal value, or if the value is null and the attribute is not defined.
 o equals(AttributeSet)
Return true if the argument contains the same attributes as this.
 o equals(Object)
Return true if the argument is an attribute set containing the same attributes as this.
 o get(String)
Returns the value of the attribute with this name, or null if the attribute is not defined.
 o getSize()
Returns the number of attributes.
 o hashCode()
Return a hash code.
 o isEmpty()
Returns true if the set is empty.
 o names()
Returns an enumeration over the names of the attributes in the set.
 o remove(Enumeration)
Remove any existing attributes with the given names.
 o remove(String)
Remove any existing attribute with the given name.
 o set(AttributeSet)
Removes all attributes, then adds the new attributes.

Variables

 o LANGUAGE
public static final String LANGUAGE
Constant for the attribute "language". The value of this attribute should be an instance of Locale.

See Also:
Locale
 o READING
public static final String READING
Constant for the attribute "reading". In languages where the written form and the pronunciation of a word are only loosely related (such as Japanese), it is often necessary to store the reading (pronunciation) along with the written form. This is an annotation attribute. The value should be an instance of Annotation holding an instance of String.

See Also:
Annotation, String
 o INPUT_METHOD_SEGMENT
public static final String INPUT_METHOD_SEGMENT
Constant for the attribute "input method segment". Input methods often break up text into segments, which usually correspond to words. This is an annotation attribute. The value should be an instance of Annotation holding a value of null.

See Also:
String
 o SWAP_COLORS
public static final String SWAP_COLORS
Swap foreground and background colors (for input method use).

Values are instances of Boolean. The default is not to swap the colors. If the foreground and backround color attributes are both defined, this causes them to be swapped when rendering text. If either is defaulted the exact effect is undefined-- generally it will produce an 'inverted' appearance.

 o SWAP_COLORS_ON
public static final Boolean SWAP_COLORS_ON
Swap foreground and background colors.

 o SWAP_COLORS_OFF
public static final Boolean SWAP_COLORS_OFF
Do not swap foreground and background colors.

 o SWAP_COLORS_DEFAULT
public static final Boolean SWAP_COLORS_DEFAULT
Default to not swap foreground and background colors.

 o FAMILY
public static final String FAMILY
The unlocalized font family name.

Values are instances of String, e.g. "Serif", "Palatino". The default value is unspecified.

 o FAMILY_ALL
public static final String FAMILY_ALL
 o WEIGHT
public static final String WEIGHT
The weight of the font.

Values are instances of Float. The value is between 0.0 and 2.0. This roughly corresponds to the ratio of the stem width to the width of regular characters for this typeface. Lower values are lighter.

 o WEIGHT_DEFAULT
public static final Float WEIGHT_DEFAULT
The default weight if WEIGHT is unspecified. This value is 1.0.

See Also:
WEIGHT
 o WEIGHT_BOLD
public static final Float WEIGHT_BOLD
The bold weight for the font. This value is 1.5.

See Also:
WEIGHT
 o WEIGHT_LIGHT
public static final Float WEIGHT_LIGHT
The light weight for the font. This value is 0.7.

See Also:
WEIGHT
 o POSTURE
public static final String POSTURE
The posture of the font.

Values are instances of Float. The value is the run/rise, generally between -1.0 and 1.0, where negative values indicate a leftwards slant, positive a rightwards slant, and zero no slant. There is no guarantee, however, that the slope of the text as returned by font will be the same as the posture value.

See Also:
getItalicAngle
 o POSTURE_DEFAULT
public static final Float POSTURE_DEFAULT
The default posture if POSTURE is unspecified. This value is 0.0.

See Also:
POSTURE
 o POSTURE_ITALIC
public static final Float POSTURE_ITALIC
The standard italic posture for the font. This value is 0.333.

See Also:
POSTURE
 o SIZE
public static final String SIZE
The font size in points.

Values are instances of Float. The value can be any positive value, although most fonts will pin to a reasonable range. The default value is unspecified.

 o TRANSFORM
public static final String TRANSFORM
The transform of the font.

Values are instances of Transform. The default value is 'null', i.e. when not specified the font uses its default transform.

 o FONT
public static final String FONT
The font to use to render this text.

Values are instances of Font. The default value is 'null', i.e. text layout will try to resolve the font as best it can for the given text.

 o BIDI_EMBEDDING
public static final String BIDI_EMBEDDING
The embedding level for nested bidirectional runs.

TextLayout assumes this feature has the same value for all text in a paragraph.

Values are instances of Integer, between 0 and 31 inclusive. Values from 0 to 15 represent embeddings. If bit 4 is set (values from 16 to 31) they represent directional overrides. Even values indicate left-to-right, odd indicate right-to-left. Within an embedding, text assumes a base line direction corresponding to the embedding, and the standard bidirectional properties of the text applies. Within an override, all text flows in the given direction, and the standard bidirectional properties of the text are overridden. See the Unicode Standard v. 2.0, section 3-11.

 o BIDI_EMBEDDING_DEFAULT
public static final Integer BIDI_EMBEDDING_DEFAULT
The default embedding if BIDI_EMBEDDING is unspecified. This value is 0.

See Also:
BIDI_EMBEDDING
 o BACKGROUND
public static final String BACKGROUND
The background color.

Values are instances of Color. The default value is 'null', meaning a transparent background.

 o FOREGROUND
public static final String FOREGROUND
The foreground color.

Values are instances of Color. The default value is 'null', meaning use the current color in the Graphics.

 o UNDERLINE
public static final String UNDERLINE
Adorn the text with underlining.

Values are instances of Byte. The standard underline is UNDERLINE_ON, the low underlines are for input method highlighting.

 o UNDERLINE_OFF
public static final Byte UNDERLINE_OFF
No underline.

 o UNDERLINE_ON
public static final Byte UNDERLINE_ON
Standard underline at the roman baseline for roman text, and below the decenders for other text.

 o UNDERLINE_LOW_ONE_PIXEL
public static final Byte UNDERLINE_LOW_ONE_PIXEL
Single pixel solid low underline.

 o UNDERLINE_LOW_TWO_PIXEL
public static final Byte UNDERLINE_LOW_TWO_PIXEL
Double pixel solid low underline.

 o UNDERLINE_LOW_DOTTED
public static final Byte UNDERLINE_LOW_DOTTED
Single pixel dotted low underline.

 o UNDERLINE_LOW_GRAY
public static final Byte UNDERLINE_LOW_GRAY
Double pixel gray low underline.

 o UNDERLINE_LOW_DASHED
public static final Byte UNDERLINE_LOW_DASHED
Single pixel dashed low underline.

 o STRIKETHROUGH
public static final String STRIKETHROUGH
Adorn the text with strikethrough.

Values are instances of Boolean.

 o STRIKETHROUGH_DEFAULT
public static final Boolean STRIKETHROUGH_DEFAULT
The default strikethrough if STRIKETHROUGH is unspecified, the value is false.

See Also:
STRIKETHROUGH
 o STRIKETHROUGH_ON
public static final Boolean STRIKETHROUGH_ON
A single strikethrough. This value is true.

See Also:
STRIKETHROUGH
 o SUPERSUBSCRIPT
public static final String SUPERSUBSCRIPT
Super and subscripting.

Values are arrays of two floats. The first value is is used to scale the point size, the second computes the offset as a ratio of the point size. For example, when applied to a 12 point font, a value of [.75, -.5] requests a point size of 9, positioned 6 points above the baseline.

 o SUPERSUBSCRIPT_DEFAULT
public static final float[] SUPERSUBSCRIPT_DEFAULT
The default supersubscript if SUPERSUBSCRIPT is unspecified. This value is [1, 0].

See Also:
SUPERSUBSCRIPT
 o SUPERSUBSCRIPT_UP1
public static final float[] SUPERSUBSCRIPT_UP1
Standard superscript. This value is [0.75, -0.5].

See Also:
SUPERSUBSCRIPT
 o SUPERSUBSCRIPT_DOWN1
public static final float[] SUPERSUBSCRIPT_DOWN1
Standard subscript. This value is [0.75, 0.5].

See Also:
SUPERSUBSCRIPT
 o JUSTIFICATION
public static final String JUSTIFICATION
Justification for the paragraph.

TextLayout assumes this feature has the same value for all text in a paragraph. Value is a float, extracted as a Double. This is a ratio controlling the space adjustment. For example, if a line's natural advance is 50 pixels, and it is asked to justify to a width of 100 pixels, a ratio of 1.0 results in a justified line with an advance of 100 pixels, and a ratio of 0.5 results in a justified line with an advance of 75 pixels.

 o JUSTIFICATION_DEFAULT
public static final Float JUSTIFICATION_DEFAULT
The default justification if JUSTIFICATION is unspecified. This value is 1.0.

See Also:
JUSTIFICATION
 o JUSTIFICATION_FULL
public static final Float JUSTIFICATION_FULL
Justify the line to the full requested width. This value is 1.0.

See Also:
JUSTIFICATION
 o JUSTIFICATION_NONE
public static final Float JUSTIFICATION_NONE
Do not allow the line to be justified. This value is 0.0.

See Also:
JUSTIFICATION
 o RUN_DIRECTION
public static final String RUN_DIRECTION
The run direction of the line, either left-to-right or right-to-left. On vertical lines, left-to-right means top-to-bottom.

TextLayout assumes this feature has the same value for all text in a paragraph.

Values are instances of boolean.

 o RUN_DIRECTION_DEFAULT
public static final Boolean RUN_DIRECTION_DEFAULT
The default direction if RUN_DIRECTION is unspecified. This value is false, indicating left-to-right.

See Also:
RUN_DIRECTION
 o RUN_DIRECTION_LTR
public static final Boolean RUN_DIRECTION_LTR
Left-to-right (top-to-bottom) run direction. This value is false.

See Also:
RUN_DIRECTION
 o RUN_DIRECTION_RTL
public static final Boolean RUN_DIRECTION_RTL
Right-to-left (bottom-to-top) run direction. This value is true.

See Also:
RUN_DIRECTION
 o BIDI_NUMERIC
public static final String BIDI_NUMERIC
The bidirectional layout control for roman numeral text.

Values are instances of Integer.

 o BIDI_NUMERIC_STRONG_ROMAN
public static final Integer BIDI_NUMERIC_STRONG_ROMAN
Interpret roman numerals as roman numerals always.

 o BIDI_NUMERIC_STRONG_ARABIC
public static final Integer BIDI_NUMERIC_STRONG_ARABIC
Interpret roman numerals as arabic numerals always.

 o BIDI_NUMERIC_WEAK_ARABIC
public static final Integer BIDI_NUMERIC_WEAK_ARABIC
Interpret roman numerals as having arabic line order.

 o BIDI_NUMERIC_DEFAULT
public static final Integer BIDI_NUMERIC_DEFAULT
 o BASELINE
public static final String BASELINE
Baseline to which to align lines.

TextLayout assumes this feature has the same value for all text in a paragraph. Regardless of the baselines to which characters align, the layout as a whole will align to this line.

Values are instances of Integer.

See Also:
ROMAN_BASELINE, CENTER_BASELINE, HANGING_BASELINE, getBaselineOffsetsFor, getBaselineFor
 o BASELINE_DEFAULT
public static final Integer BASELINE_DEFAULT
The default baseline if BASELINE is unspecified. This value is Font.ROMAN_BASELINE.

See Also:
BASELINE
 o BASELINE_ROMAN
public static final Integer BASELINE_ROMAN
Use a roman baseline for the line. This value is Font.ROMAN_BASELINE.

See Also:
BASELINE
 o BASELINE_IDEOGRAPHIC
public static final Integer BASELINE_IDEOGRAPHIC
Use a center baseline for the line. This value is Font.CENTER_BASELINE.

See Also:
BASELINE
 o BASELINE_HANGING
public static final Integer BASELINE_HANGING
Use a hanging baseline for the line. This value is Font.HANGING_BASELINE.

See Also:
BASELINE
 o BASELINE_OFFSETS
public static final String BASELINE_OFFSETS
Baseline offsets used by a line.

TextLayout assumes this feature has the same value for all text in a paragraph.

Values are arrays of three floats. The distance from one baseline to another is offsets[b] - offsets[a], where a is the starting baseline. For example, the distance from the hanging baseline to the ideographic baseline is: offsets[BASELINE_IDEOGRAPHIC.byteValue()]- offsets[BASELINE_HANGING.byteValue()]

If defaulted, TextLayout attempts to find a reasonable value for all text in the paragraph.

 o EMPTY
public static final AttributeSet EMPTY
An empty attribute set, for convenience.

Constructors

 o TextAttributeSet
public TextAttributeSet()
Construct a new mutable attribute set.

 o TextAttributeSet
public TextAttributeSet(AttributeSet source)
Construct a new mutable attribute set containing the provided attributes.

Parameters:
source - the attributes to copy into this set.
 o TextAttributeSet
public TextAttributeSet(String name,
                        Object value)
Construct a new mutable attribute set containing the provided attribute.

Parameters:
name - the name of the attribute.
value - the value of the attribute.

Methods

 o isEmpty
public boolean isEmpty()
Returns true if the set is empty.

 o getSize
public int getSize()
Returns the number of attributes.

 o names
public Enumeration names()
Returns an enumeration over the names of the attributes in the set. The elements of the enumeration are all Strings.

 o get
public Object get(String name)
Returns the value of the attribute with this name, or null if the attribute is not defined.

 o contains
public boolean contains(String name,
                        Object value)
Returns true if this set contains this attribute with an equal value, or if the value is null and the attribute is not defined.

 o contains
public boolean contains(AttributeSet rhs)
Returns true if this set contains all the attributes with equal values.

 o equals
public boolean equals(Object rhs)
Return true if the argument is an attribute set containing the same attributes as this.

Parameters:
rhs - the object which may be an attribute set.
Overrides:
equals in class Object
 o equals
public boolean equals(AttributeSet rhs)
Return true if the argument contains the same attributes as this.

Parameters:
rhs - the attribute set to test against.
 o hashCode
public int hashCode()
Return a hash code.

Overrides:
hashCode in class Object
 o add
public void add(String name,
                Object value)
Remove any existing attribute with the same name, and add a new attribute with the given name and value. The value must be immutable, or not mutated by any client.

Parameters:
name - the name of the attribute to add
value - the value of the attribute to add
 o add
public void add(AttributeSet attributes)
Remove any existing attributes with the same names, and add the new attributes.

Parameters:
attributes - the set of attributes to add
 o remove
public void remove(String name)
Remove any existing attribute with the given name.

Parameters:
name - the name of the attribute to remove
 o remove
public void remove(Enumeration names)
Remove any existing attributes with the given names.

Parameters:
names - an enumeration over the names of attributes to remove. The elements of the enumeration are Strings.
 o set
public void set(AttributeSet attributes)
Removes all attributes, then adds the new attributes.

 o clone
public Object clone()
Return a copy of this attribute set. Attributes are shared with the copy.

Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature