APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.text

public sealed Class StyleConstants

extends Object
permits CharacterConstants, ColorConstants, FontConstants, ParagraphConstants
Class Inheritance
Known Direct Subclasses
javax.swing.text.StyleConstants.ParagraphConstants, javax.swing.text.StyleConstants.CharacterConstants, javax.swing.text.StyleConstants.ColorConstants, javax.swing.text.StyleConstants.FontConstants
Imports
java.awt.Color, .Component, .Toolkit, javax.swing.Icon

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.

Diagram shows SpaceAbove, FirstLineIndent, LeftIndent, RightIndent,
     and SpaceBelow a paragraph.

Author
Timothy Prinzing

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
StyleConstants.CharacterConstants

This is a typesafe enumeration of the well-known attributes that contribute to a character style.

public static class
StyleConstants.ColorConstants

This is a typesafe enumeration of the well-known attributes that contribute to a color.

public static class
StyleConstants.FontConstants

This is a typesafe enumeration of the well-known attributes that contribute to a font.

public static class
StyleConstants.ParagraphConstants

This is a typesafe enumeration of the well-known attributes that contribute to a paragraph style.

Field Summary

Modifier and TypeField and Description
public static final int
ALIGN_CENTER

A possible value for paragraph alignment.

public static final int
ALIGN_JUSTIFIED

A possible value for paragraph alignment.

public static final int
ALIGN_LEFT

A possible value for paragraph alignment.

public static final int
ALIGN_RIGHT

A possible value for paragraph alignment.

public static final Object
Alignment

Alignment for the paragraph.

public static final Object
Background

Name of the background color attribute.

public static final Object
BidiLevel

Bidirectional level of a character as assigned by the Unicode bidi algorithm.

public static final Object
Bold

Name of the bold attribute.

public static final Object
ComponentAttribute

Name of the component attribute.

public static final String
ComponentElementName

Name of elements used to represent components.

public static final Object
ComposedTextAttribute

Name of the input method composed text attribute.

public static final Object
Family

Name of the font family.

public static final Object
FirstLineIndent

The amount of space to indent the first line of the paragraph.

public static final Object
FontFamily

Name of the font family.

public static final Object
FontSize

Name of the font size.

public static final Object
Foreground

Name of the foreground color attribute.

public static final Object
IconAttribute

Name of the icon attribute.

public static final String
IconElementName

Name of elements used to represent icons.

public static final Object
Italic

Name of the italic attribute.

pack-priv static Object[]
public static final Object
LeftIndent

The amount to indent the left side of the paragraph.

public static final Object
LineSpacing

The amount of space between lines of the paragraph.

public static final Object
ModelAttribute

Attribute used to identify the model for embedded objects that have a model view separation.

public static final Object
NameAttribute

Attribute name used to name the collection of attributes.

public static final Object
Orientation

Orientation for a paragraph.

private String
public static final Object
ResolveAttribute

Attribute name used to identify the resolving parent set of attributes, if one is defined.

public static final Object
RightIndent

The amount to indent the right side of the paragraph.

public static final Object
Size

Name of the font size.

public static final Object
SpaceAbove

The amount of space above the paragraph.

public static final Object
SpaceBelow

The amount of space below the paragraph.

public static final Object
StrikeThrough

Name of the Strikethrough attribute.

public static final Object
Subscript

Name of the Subscript attribute.

public static final Object
Superscript

Name of the Superscript attribute.

public static final Object
TabSet

TabSet for the paragraph, type is a TabSet containing TabStops.

public static final Object
Underline

Name of the underline attribute.

Constructor Summary

AccessConstructor and Description
pack-priv
StyleConstants(String representation)

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

the value StyleConstants.ALIGN_LEFT if not set
getAlignment
(AttributeSet
the attribute set
a
)

Gets the alignment setting.

public static Color

Returns:

the color, Color.black as the default
getBackground
(AttributeSet
the attribute set
a
)

Gets the background color setting from the attribute list.

public static int

Returns:

the value
getBidiLevel
(AttributeSet
the attribute set
a
)

Gets the BidiLevel setting.

public static Component

Returns:

the component, null if none
getComponent
(AttributeSet
the attribute set
a
)

Gets the component setting from the attribute list.

public static float

Returns:

the value, 0 if not set
getFirstLineIndent
(AttributeSet
the attribute set
a
)

Gets the first line indent setting.

public static String

Returns:

the font family, "Monospaced" as the default
getFontFamily
(AttributeSet
the attribute set
a
)

Gets the font family setting from the attribute list.

public static int

Returns:

the font size, 12 as the default
getFontSize
(AttributeSet
the attribute set
a
)

Gets the font size setting from the attribute list.

public static Color

Returns:

the color, Color.black as the default
getForeground
(AttributeSet
the attribute set
a
)

Gets the foreground color setting from the attribute list.

public static Icon

Returns:

the icon, null if none
getIcon
(AttributeSet
the attribute set
a
)

Gets the icon setting from the attribute list.

public static float

Returns:

the value, 0 if not set
getLeftIndent
(AttributeSet
the attribute set
a
)

Gets the left indent setting.

public static float

Returns:

the value, 0 if not set
getLineSpacing
(AttributeSet
the attribute set
a
)

Gets the line spacing setting.

public static float

Returns:

the value, 0 if not set
getRightIndent
(AttributeSet
the attribute set
a
)

Gets the right indent setting.

public static float

Returns:

the value, 0 if not set
getSpaceAbove
(AttributeSet
the attribute set
a
)

Gets the space above setting.

public static float

Returns:

the value, 0 if not set
getSpaceBelow
(AttributeSet
the attribute set
a
)

Gets the space below setting.

public static TabSet

Returns:

the TabSet
getTabSet
(AttributeSet
the attribute set
a
)

Gets the TabSet.

public static boolean

Returns:

true if set else false
isBold
(AttributeSet
the attribute set
a
)

Checks whether the bold attribute is set.

public static boolean

Returns:

true if set else false
isItalic
(AttributeSet
the attribute set
a
)

Checks whether the italic attribute is set.

public static boolean

Returns:

true if set else false
isStrikeThrough
(AttributeSet
the attribute set
a
)

Checks whether the strikethrough attribute is set.

public static boolean

Returns:

true if set else false
isSubscript
(AttributeSet
the attribute set
a
)

Checks whether the subscript attribute is set.

public static boolean

Returns:

true if set else false
isSuperscript
(AttributeSet
the attribute set
a
)

Checks whether the superscript attribute is set.

public static boolean

Returns:

true if set else false
isUnderline
(AttributeSet
the attribute set
a
)

Checks whether the underline attribute is set.

public static void
setAlignment(MutableAttributeSet
the attribute set
a
,
int
the alignment value
align
)

Sets alignment.

public static void
setBackground(MutableAttributeSet
the attribute set
a
,
Color
the color
fg
)

Sets the background color.

public static void
setBidiLevel(MutableAttributeSet
the attribute set
a
,
int
the bidi level value
o
)

Sets the BidiLevel.

public static void
setBold(MutableAttributeSet
the attribute set
a
,
boolean
specifies true/false for setting the attribute
b
)

Sets the bold attribute.

public static void
setComponent(MutableAttributeSet
the attribute set
a
,
Component
the component
c
)

Sets the component attribute.

public static void
setFirstLineIndent(MutableAttributeSet
the attribute set
a
,
float
the value
i
)

Sets the first line indent.

public static void
setFontFamily(MutableAttributeSet
the attribute set
a
,
String
the font
fam
)

Sets the font attribute.

public static void
setFontSize(MutableAttributeSet
the attribute set
a
,
int
the font size
s
)

Sets the font size attribute.

public static void
setForeground(MutableAttributeSet
the attribute set
a
,
Color
the color
fg
)

Sets the foreground color.

public static void
setIcon(MutableAttributeSet
the attribute set
a
,
Icon
the icon
c
)

Sets the icon attribute.

public static void
setItalic(MutableAttributeSet
the attribute set
a
,
boolean
specifies true/false for setting the attribute
b
)

Sets the italic attribute.

public static void
setLeftIndent(MutableAttributeSet
the attribute set
a
,
float
the value
i
)

Sets left indent.

public static void
setLineSpacing(MutableAttributeSet
the attribute set
a
,
float
the value
i
)

Sets line spacing.

public static void
setRightIndent(MutableAttributeSet
the attribute set
a
,
float
the value
i
)

Sets right indent.

public static void
setSpaceAbove(MutableAttributeSet
the attribute set
a
,
float
the value
i
)

Sets space above.

public static void
setSpaceBelow(MutableAttributeSet
the attribute set
a
,
float
the value
i
)

Sets space below.

public static void
setStrikeThrough(MutableAttributeSet
the attribute set
a
,
boolean
specifies true/false for setting the attribute
b
)

Sets the strikethrough attribute.

public static void
setSubscript(MutableAttributeSet
the attribute set
a
,
boolean
specifies true/false for setting the attribute
b
)

Sets the subscript attribute.

public static void
setSuperscript(MutableAttributeSet
the attribute set
a
,
boolean
specifies true/false for setting the attribute
b
)

Sets the superscript attribute.

public static void
setTabSet(MutableAttributeSet
the attribute set.
a
,
TabSet
the TabSet
tabs
)

Sets the TabSet.

public static void
setUnderline(MutableAttributeSet
the attribute set
a
,
boolean
specifies true/false for setting the attribute
b
)

Sets the underline attribute.

public String

Returns:

the string
toString
()

Overrides java.lang.Object.toString.

Returns the string representation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait