java.lang.Object
javax.swing.text.StyleConstants
- Direct Known Subclasses:
- StyleConstants.CharacterConstants,- StyleConstants.ColorConstants,- StyleConstants.FontConstants,- StyleConstants.ParagraphConstants
A collection of well known or common attribute keys and methods to apply to an AttributeSet or MutableAttributeSet to get/set the properties in a typesafe manner.
The paragraph attributes form the definition of a paragraph to be rendered. All sizes are specified in points (such as found in postscript), a device independent measure.

- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classThis is a typesafe enumeration of the well-known attributes that contribute to a character style.static classThis is a typesafe enumeration of the well-known attributes that contribute to a color.static classThis is a typesafe enumeration of the well-known attributes that contribute to a font.static classThis is a typesafe enumeration of the well-known attributes that contribute to a paragraph style.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intA possible value for paragraph alignment.static final intA possible value for paragraph alignment.static final intA possible value for paragraph alignment.static final intA possible value for paragraph alignment.static final ObjectAlignment for the paragraph.static final ObjectName of the background color attribute.static final ObjectBidirectional level of a character as assigned by the Unicode bidi algorithm.static final ObjectName of the bold attribute.static final ObjectName of the component attribute.static final StringName of elements used to represent components.static final ObjectName of the input method composed text attribute.static final ObjectName of the font family.static final ObjectThe amount of space to indent the first line of the paragraph.static final ObjectName of the font family.static final ObjectName of the font size.static final ObjectName of the foreground color attribute.static final ObjectName of the icon attribute.static final StringName of elements used to represent icons.static final ObjectName of the italic attribute.static final ObjectThe amount to indent the left side of the paragraph.static final ObjectThe amount of space between lines of the paragraph.static final ObjectAttribute used to identify the model for embedded objects that have a model view separation.static final ObjectAttribute name used to name the collection of attributes.static final ObjectOrientation for a paragraph.static final ObjectAttribute name used to identify the resolving parent set of attributes, if one is defined.static final ObjectThe amount to indent the right side of the paragraph.static final ObjectName of the font size.static final ObjectThe amount of space above the paragraph.static final ObjectThe amount of space below the paragraph.static final ObjectName of the Strikethrough attribute.static final ObjectName of the Subscript attribute.static final ObjectName of the Superscript attribute.static final ObjectTabSet for the paragraph, type is a TabSet containing TabStops.static final ObjectName of the underline attribute.
- 
Method SummaryModifier and TypeMethodDescriptionstatic intGets the alignment setting.static ColorGets the background color setting from the attribute list.static intGets the BidiLevel setting.static ComponentGets the component setting from the attribute list.static floatGets the first line indent setting.static StringGets the font family setting from the attribute list.static intGets the font size setting from the attribute list.static ColorGets the foreground color setting from the attribute list.static IconGets the icon setting from the attribute list.static floatGets the left indent setting.static floatGets the line spacing setting.static floatGets the right indent setting.static floatGets the space above setting.static floatGets the space below setting.static TabSetGets the TabSet.static booleanChecks whether the bold attribute is set.static booleanChecks whether the italic attribute is set.static booleanChecks whether the strikethrough attribute is set.static booleanChecks whether the subscript attribute is set.static booleanChecks whether the superscript attribute is set.static booleanChecks whether the underline attribute is set.static voidsetAlignment(MutableAttributeSet a, int align) Sets alignment.static voidSets the background color.static voidsetBidiLevel(MutableAttributeSet a, int o) Sets the BidiLevel.static voidsetBold(MutableAttributeSet a, boolean b) Sets the bold attribute.static voidSets the component attribute.static voidsetFirstLineIndent(MutableAttributeSet a, float i) Sets the first line indent.static voidsetFontFamily(MutableAttributeSet a, String fam) Sets the font attribute.static voidsetFontSize(MutableAttributeSet a, int s) Sets the font size attribute.static voidSets the foreground color.static voidsetIcon(MutableAttributeSet a, Icon c) Sets the icon attribute.static voidsetItalic(MutableAttributeSet a, boolean b) Sets the italic attribute.static voidsetLeftIndent(MutableAttributeSet a, float i) Sets left indent.static voidsetLineSpacing(MutableAttributeSet a, float i) Sets line spacing.static voidsetRightIndent(MutableAttributeSet a, float i) Sets right indent.static voidsetSpaceAbove(MutableAttributeSet a, float i) Sets space above.static voidsetSpaceBelow(MutableAttributeSet a, float i) Sets space below.static voidsetStrikeThrough(MutableAttributeSet a, boolean b) Sets the strikethrough attribute.static voidsetSubscript(MutableAttributeSet a, boolean b) Sets the subscript attribute.static voidsetSuperscript(MutableAttributeSet a, boolean b) Sets the superscript attribute.static voidsetTabSet(MutableAttributeSet a, TabSet tabs) Sets the TabSet.static voidsetUnderline(MutableAttributeSet a, boolean b) Sets the underline attribute.toString()Returns the string representation.
- 
Field Details- 
ComponentElementNameName of elements used to represent components.- See Also:
 
- 
IconElementNameName of elements used to represent icons.- See Also:
 
- 
NameAttributeAttribute name used to name the collection of attributes.
- 
ResolveAttributeAttribute name used to identify the resolving parent set of attributes, if one is defined.
- 
ModelAttributeAttribute used to identify the model for embedded objects that have a model view separation.
- 
BidiLevelBidirectional level of a character as assigned by the Unicode bidi algorithm.
- 
FontFamilyName of the font family.
- 
FamilyName of the font family.- Since:
- 1.5
 
- 
FontSizeName of the font size.
- 
SizeName of the font size.- Since:
- 1.5
 
- 
BoldName of the bold attribute.
- 
ItalicName of the italic attribute.
- 
UnderlineName of the underline attribute.
- 
StrikeThroughName of the Strikethrough attribute.
- 
SuperscriptName of the Superscript attribute.
- 
SubscriptName of the Subscript attribute.
- 
ForegroundName of the foreground color attribute.
- 
BackgroundName of the background color attribute.
- 
ComponentAttributeName of the component attribute.
- 
IconAttributeName of the icon attribute.
- 
ComposedTextAttributeName of the input method composed text attribute. The value of this attribute is an instance of AttributedString which represents the composed text.
- 
FirstLineIndentThe amount of space to indent the first line of the paragraph. This value may be negative to offset in the reverse direction. The type is Float and specifies the size of the space in points.
- 
LeftIndentThe amount to indent the left side of the paragraph. Type is float and specifies the size in points.
- 
RightIndentThe amount to indent the right side of the paragraph. Type is float and specifies the size in points.
- 
LineSpacingThe amount of space between lines of the paragraph. Type is float and specifies the size as a factor of the line height
- 
SpaceAboveThe amount of space above the paragraph. Type is float and specifies the size in points.
- 
SpaceBelowThe amount of space below the paragraph. Type is float and specifies the size in points.
- 
AlignmentAlignment for the paragraph. The type is Integer. Valid values are:- ALIGN_LEFT
- ALIGN_RIGHT
- ALIGN_CENTER
- ALIGN_JUSTIFED
 
- 
TabSetTabSet for the paragraph, type is a TabSet containing TabStops.
- 
OrientationOrientation for a paragraph.
- 
ALIGN_LEFTpublic static final int ALIGN_LEFTA possible value for paragraph alignment. This specifies that the text is aligned to the left indent and extra whitespace should be placed on the right.- See Also:
 
- 
ALIGN_CENTERpublic static final int ALIGN_CENTERA possible value for paragraph alignment. This specifies that the text is aligned to the center and extra whitespace should be placed equally on the left and right.- See Also:
 
- 
ALIGN_RIGHTpublic static final int ALIGN_RIGHTA possible value for paragraph alignment. This specifies that the text is aligned to the right indent and extra whitespace should be placed on the left.- See Also:
 
- 
ALIGN_JUSTIFIEDpublic static final int ALIGN_JUSTIFIEDA possible value for paragraph alignment. This specifies that extra whitespace should be spread out through the rows of the paragraph with the text lined up with the left and right indent except on the last line which should be aligned to the left.- See Also:
 
 
- 
- 
Method Details- 
toStringReturns the string representation.
- 
getBidiLevelGets the BidiLevel setting.- Parameters:
- a- the attribute set
- Returns:
- the value
 
- 
setBidiLevelSets the BidiLevel.- Parameters:
- a- the attribute set
- o- the bidi level value
 
- 
getComponentGets the component setting from the attribute list.- Parameters:
- a- the attribute set
- Returns:
- the component, null if none
 
- 
setComponentSets the component attribute.- Parameters:
- a- the attribute set
- c- the component
 
- 
getIconGets the icon setting from the attribute list.- Parameters:
- a- the attribute set
- Returns:
- the icon, null if none
 
- 
setIconSets the icon attribute.- Parameters:
- a- the attribute set
- c- the icon
 
- 
getFontFamilyGets the font family setting from the attribute list.- Parameters:
- a- the attribute set
- Returns:
- the font family, "Monospaced" as the default
 
- 
setFontFamilySets the font attribute.- Parameters:
- a- the attribute set
- fam- the font
 
- 
getFontSizeGets the font size setting from the attribute list.- Parameters:
- a- the attribute set
- Returns:
- the font size, 12 as the default
 
- 
setFontSizeSets the font size attribute.- Parameters:
- a- the attribute set
- s- the font size
 
- 
isBoldChecks whether the bold attribute is set.- Parameters:
- a- the attribute set
- Returns:
- true if set else false
 
- 
setBoldSets the bold attribute.- Parameters:
- a- the attribute set
- b- specifies true/false for setting the attribute
 
- 
isItalicChecks whether the italic attribute is set.- Parameters:
- a- the attribute set
- Returns:
- true if set else false
 
- 
setItalicSets the italic attribute.- Parameters:
- a- the attribute set
- b- specifies true/false for setting the attribute
 
- 
isUnderlineChecks whether the underline attribute is set.- Parameters:
- a- the attribute set
- Returns:
- true if set else false
 
- 
isStrikeThroughChecks whether the strikethrough attribute is set.- Parameters:
- a- the attribute set
- Returns:
- true if set else false
 
- 
isSuperscriptChecks whether the superscript attribute is set.- Parameters:
- a- the attribute set
- Returns:
- true if set else false
 
- 
isSubscriptChecks whether the subscript attribute is set.- Parameters:
- a- the attribute set
- Returns:
- true if set else false
 
- 
setUnderlineSets the underline attribute.- Parameters:
- a- the attribute set
- b- specifies true/false for setting the attribute
 
- 
setStrikeThroughSets the strikethrough attribute.- Parameters:
- a- the attribute set
- b- specifies true/false for setting the attribute
 
- 
setSuperscriptSets the superscript attribute.- Parameters:
- a- the attribute set
- b- specifies true/false for setting the attribute
 
- 
setSubscriptSets the subscript attribute.- Parameters:
- a- the attribute set
- b- specifies true/false for setting the attribute
 
- 
getForegroundGets the foreground color setting from the attribute list.- Parameters:
- a- the attribute set
- Returns:
- the color, Color.black as the default
 
- 
setForegroundSets the foreground color.- Parameters:
- a- the attribute set
- fg- the color
 
- 
getBackgroundGets the background color setting from the attribute list.- Parameters:
- a- the attribute set
- Returns:
- the color, Color.black as the default
 
- 
setBackgroundSets the background color.- Parameters:
- a- the attribute set
- fg- the color
 
- 
getFirstLineIndentGets the first line indent setting.- Parameters:
- a- the attribute set
- Returns:
- the value, 0 if not set
 
- 
setFirstLineIndentSets the first line indent.- Parameters:
- a- the attribute set
- i- the value
 
- 
getRightIndentGets the right indent setting.- Parameters:
- a- the attribute set
- Returns:
- the value, 0 if not set
 
- 
setRightIndentSets right indent.- Parameters:
- a- the attribute set
- i- the value
 
- 
getLeftIndentGets the left indent setting.- Parameters:
- a- the attribute set
- Returns:
- the value, 0 if not set
 
- 
setLeftIndentSets left indent.- Parameters:
- a- the attribute set
- i- the value
 
- 
getLineSpacingGets the line spacing setting.- Parameters:
- a- the attribute set
- Returns:
- the value, 0 if not set
 
- 
setLineSpacingSets line spacing.- Parameters:
- a- the attribute set
- i- the value
 
- 
getSpaceAboveGets the space above setting.- Parameters:
- a- the attribute set
- Returns:
- the value, 0 if not set
 
- 
setSpaceAboveSets space above.- Parameters:
- a- the attribute set
- i- the value
 
- 
getSpaceBelowGets the space below setting.- Parameters:
- a- the attribute set
- Returns:
- the value, 0 if not set
 
- 
setSpaceBelowSets space below.- Parameters:
- a- the attribute set
- i- the value
 
- 
getAlignmentGets the alignment setting.- Parameters:
- a- the attribute set
- Returns:
- the value StyleConstants.ALIGN_LEFTif not set
 
- 
setAlignmentSets alignment.- Parameters:
- a- the attribute set
- align- the alignment value
 
- 
getTabSetGets the TabSet.- Parameters:
- a- the attribute set
- Returns:
- the TabSet
 
- 
setTabSetSets the TabSet.- Parameters:
- a- the attribute set.
- tabs- the TabSet
 
 
-