This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text
class StyleConstants

java.lang.Object extended by javax.swing.text.StyleConstants
Direct Known Subclasses:
StyleConstants.CharacterConstants, StyleConstants.ColorConstants, StyleConstants.FontConstants, StyleConstants.ParagraphConstants

public class StyleConstants
extends Object

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.


Nested Class Summary
static class

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

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

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

           This is a typesafe enumeration of the well-known attributes that contribute to a paragraph style.
 
Field Summary
static Object Alignment
          Alignment for the paragraph.
static int ALIGN_CENTER
          A possible value for paragraph alignment.
static int ALIGN_JUSTIFIED
          A possible value for paragraph alignment.
static int ALIGN_LEFT
          A possible value for paragraph alignment.
static int ALIGN_RIGHT
          A possible value for paragraph alignment.
static Object Background
          Name of the background color attribute.
static Object BidiLevel
          Bidirectional level of a character as assigned by the Unicode bidi algorithm.
static Object Bold
          Name of the bold attribute.
static Object ComponentAttribute
          Name of the component attribute.
static String ComponentElementName
          Name of elements used to represent components.
static Object ComposedTextAttribute
          Name of the input method composed text attribute.
static Object Family
          Name of the font family.
static Object FirstLineIndent
          The amount of space to indent the first line of the paragraph.
static Object FontFamily
          Name of the font family.
static Object FontSize
          Name of the font size.
static Object Foreground
          Name of the foreground color attribute.
static Object IconAttribute
          Name of the icon attribute.
static String IconElementName
          Name of elements used to represent icons.
static Object Italic
          Name of the italic attribute.
static Object LeftIndent
          The amount to indent the left side of the paragraph.
static Object LineSpacing
          The amount of space between lines of the paragraph.
static Object ModelAttribute
          Attribute used to identify the model for embedded objects that have a model view separation.
static Object NameAttribute
          Attribute name used to name the collection of attributes.
static Object Orientation
          Orientation for a paragraph.
static Object ResolveAttribute
          Attribute name used to identifiy the resolving parent set of attributes, if one is defined.
static Object RightIndent
          The amount to indent the right side of the paragraph.
static Object Size
          Name of the font size.
static Object SpaceAbove
          The amount of space above the paragraph.
static Object SpaceBelow
          The amount of space below the paragraph.
static Object StrikeThrough
          Name of the Strikethrough attribute.
static Object Subscript
          Name of the Subscript attribute.
static Object Superscript
          Name of the Superscript attribute.
static Object TabSet
          TabSet for the paragraph, type is a TabSet containing TabStops.
static Object Underline
          Name of the underline attribute.
 
Method Summary
static int

          Gets the alignment setting.
static Color

          Gets the background color setting from the attribute list.
static int

          Gets the BidiLevel setting.
static Component

          Gets the component setting from the attribute list.
static float

          Gets the first line indent setting.
static String

          Gets the font family setting from the attribute list.
static int

          Gets the font size setting from the attribute list.
static Color

          Gets the foreground color setting from the attribute list.
static Icon

          Gets the icon setting from the attribute list.
static float

          Gets the left indent setting.
static float

          Gets the line spacing setting.
static float

          Gets the right indent setting.
static float

          Gets the space above setting.
static float

          Gets the space below setting.
static TabSet

          Gets the TabSet.
static boolean

          Checks whether the bold attribute is set.
static boolean

          Checks whether the italic attribute is set.
static boolean

          Checks whether the strikethrough attribute is set.
static boolean

          Checks whether the subscript attribute is set.
static boolean

          Checks whether the superscript attribute is set.
static boolean

          Checks whether the underline attribute is set.
static void

          Sets alignment.
static void

          Sets the background color.
static void

          Sets the BidiLevel.
static void

          Sets the bold attribute.
static void

          Sets the component attribute.
static void

          Sets the first line indent.
static void

          Sets the font attribute.
static void

          Sets the font size attribute.
static void

          Sets the foreground color.
static void

          Sets the icon attribute.
static void

          Sets the italic attribute.
static void

          Sets left indent.
static void

          Sets line spacing.
static void

          Sets right indent.
static void

          Sets space above.
static void

          Sets space below.
static void

          Sets the strikethrough attribute.
static void

          Sets the subscript attribute.
static void

          Sets the superscript attribute.
static void

          Sets the TabSet.
static void

          Sets the underline attribute.
 String

          Returns the string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Alignment

public static final Object Alignment
Alignment for the paragraph. The type is Integer. Valid values are:

ALIGN_CENTER

public static final int ALIGN_CENTER
A 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.

ALIGN_JUSTIFIED

public static final int ALIGN_JUSTIFIED
A 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.

ALIGN_LEFT

public static final int ALIGN_LEFT
A 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.

ALIGN_RIGHT

public static final int ALIGN_RIGHT
A 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.

Background

public static final Object Background
Name of the background color attribute.

BidiLevel

public static final Object BidiLevel
Bidirectional level of a character as assigned by the Unicode bidi algorithm.

Bold

public static final Object Bold
Name of the bold attribute.

ComponentAttribute

public static final Object ComponentAttribute
Name of the component attribute.

ComponentElementName

public static final String ComponentElementName
Name of elements used to represent components.

ComposedTextAttribute

public static final Object ComposedTextAttribute
Name of the input method composed text attribute. The value of this attribute is an instance of AttributedString which represents the composed text.

Family

public static final Object Family
Name of the font family.

FirstLineIndent

public static final Object FirstLineIndent
The 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.

FontFamily

public static final Object FontFamily
Name of the font family.

FontSize

public static final Object FontSize
Name of the font size.

Foreground

public static final Object Foreground
Name of the foreground color attribute.

IconAttribute

public static final Object IconAttribute
Name of the icon attribute.

IconElementName

public static final String IconElementName
Name of elements used to represent icons.

Italic

public static final Object Italic
Name of the italic attribute.

LeftIndent

public static final Object LeftIndent
The amount to indent the left side of the paragraph. Type is float and specifies the size in points.

LineSpacing

public static final Object LineSpacing
The amount of space between lines of the paragraph. Type is float and specifies the size as a factor of the line height

ModelAttribute

public static final Object ModelAttribute
Attribute used to identify the model for embedded objects that have a model view separation.

NameAttribute

public static final Object NameAttribute
Attribute name used to name the collection of attributes.

Orientation

public static final Object Orientation
Orientation for a paragraph.

ResolveAttribute

public static final Object ResolveAttribute
Attribute name used to identifiy the resolving parent set of attributes, if one is defined.

RightIndent

public static final Object RightIndent
The amount to indent the right side of the paragraph. Type is float and specifies the size in points.

Size

public static final Object Size
Name of the font size.

SpaceAbove

public static final Object SpaceAbove
The amount of space above the paragraph. Type is float and specifies the size in points.

SpaceBelow

public static final Object SpaceBelow
The amount of space below the paragraph. Type is float and specifies the size in points.

StrikeThrough

public static final Object StrikeThrough
Name of the Strikethrough attribute.

Subscript

public static final Object Subscript
Name of the Subscript attribute.

Superscript

public static final Object Superscript
Name of the Superscript attribute.

TabSet

public static final Object TabSet
TabSet for the paragraph, type is a TabSet containing TabStops.

Underline

public static final Object Underline
Name of the underline attribute.
Method Detail

getAlignment

public static int getAlignment(AttributeSet a)
Gets the alignment setting.

Parameters:
a - the attribute set
Returns:
the value StyleConstants.ALIGN_LEFT if not set

getBackground

public static Color getBackground(AttributeSet a)
Gets the background color setting from the attribute list.

Parameters:
a - the attribute set
Returns:
the color, Color.black as the default

getBidiLevel

public static int getBidiLevel(AttributeSet a)
Gets the BidiLevel setting.

Parameters:
a - the attribute set
Returns:
the value

getComponent

public static Component getComponent(AttributeSet a)
Gets the component setting from the attribute list.

Parameters:
a - the attribute set
Returns:
the component, null if none

getFirstLineIndent

public static float getFirstLineIndent(AttributeSet a)
Gets the first line indent setting.

Parameters:
a - the attribute set
Returns:
the value, 0 if not set

getFontFamily

public static String getFontFamily(AttributeSet a)
Gets the font family setting from the attribute list.

Parameters:
a - the attribute set
Returns:
the font family, "Monospaced" as the default

getFontSize

public static int getFontSize(AttributeSet a)
Gets the font size setting from the attribute list.

Parameters:
a - the attribute set
Returns:
the font size, 12 as the default

getForeground

public static Color getForeground(AttributeSet a)
Gets the foreground color setting from the attribute list.

Parameters:
a - the attribute set
Returns:
the color, Color.black as the default

getIcon

public static Icon getIcon(AttributeSet a)
Gets the icon setting from the attribute list.

Parameters:
a - the attribute set
Returns:
the icon, null if none

getLeftIndent

public static float getLeftIndent(AttributeSet a)
Gets the left indent setting.

Parameters:
a - the attribute set
Returns:
the value, 0 if not set

getLineSpacing

public static float getLineSpacing(AttributeSet a)
Gets the line spacing setting.

Parameters:
a - the attribute set
Returns:
the value, 0 if not set

getRightIndent

public static float getRightIndent(AttributeSet a)
Gets the right indent setting.

Parameters:
a - the attribute set
Returns:
the value, 0 if not set

getSpaceAbove

public static float getSpaceAbove(AttributeSet a)
Gets the space above setting.

Parameters:
a - the attribute set
Returns:
the value, 0 if not set

getSpaceBelow

public static float getSpaceBelow(AttributeSet a)
Gets the space below setting.

Parameters:
a - the attribute set
Returns:
the value, 0 if not set

getTabSet

public static TabSet getTabSet(AttributeSet a)
Gets the TabSet.

Parameters:
a - the attribute set
Returns:
the TabSet

isBold

public static boolean isBold(AttributeSet a)
Checks whether the bold attribute is set.

Parameters:
a - the attribute set
Returns:
true if set else false

isItalic

public static boolean isItalic(AttributeSet a)
Checks whether the italic attribute is set.

Parameters:
a - the attribute set
Returns:
true if set else false

isStrikeThrough

public static boolean isStrikeThrough(AttributeSet a)
Checks whether the strikethrough attribute is set.

Parameters:
a - the attribute set
Returns:
true if set else false

isSubscript

public static boolean isSubscript(AttributeSet a)
Checks whether the subscript attribute is set.

Parameters:
a - the attribute set
Returns:
true if set else false

isSuperscript

public static boolean isSuperscript(AttributeSet a)
Checks whether the superscript attribute is set.

Parameters:
a - the attribute set
Returns:
true if set else false

isUnderline

public static boolean isUnderline(AttributeSet a)
Checks whether the underline attribute is set.

Parameters:
a - the attribute set
Returns:
true if set else false

setAlignment

public static void setAlignment(MutableAttributeSet a,
                                int align)
Sets alignment.

Parameters:
a - the attribute set
align - the alignment value

setBackground

public static void setBackground(MutableAttributeSet a,
                                 Color fg)
Sets the background color.

Parameters:
a - the attribute set
fg - the color

setBidiLevel

public static void setBidiLevel(MutableAttributeSet a,
                                int o)
Sets the BidiLevel.

Parameters:
a - the attribute set
o - the bidi level value

setBold

public static void setBold(MutableAttributeSet a,
                           boolean b)
Sets the bold attribute.

Parameters:
a - the attribute set
b - specifies true/false for setting the attribute

setComponent

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

Parameters:
a - the attribute set
c - the component

setFirstLineIndent

public static void setFirstLineIndent(MutableAttributeSet a,
                                      float i)
Sets the first line indent.

Parameters:
a - the attribute set
i - the value

setFontFamily

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

Parameters:
a - the attribute set
fam - the font

setFontSize

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

Parameters:
a - the attribute set
s - the font size

setForeground

public static void setForeground(MutableAttributeSet a,
                                 Color fg)
Sets the foreground color.

Parameters:
a - the attribute set
fg - the color

setIcon

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

Parameters:
a - the attribute set
c - the icon

setItalic

public static void setItalic(MutableAttributeSet a,
                             boolean b)
Sets the italic attribute.

Parameters:
a - the attribute set
b - specifies true/false for setting the attribute

setLeftIndent

public static void setLeftIndent(MutableAttributeSet a,
                                 float i)
Sets left indent.

Parameters:
a - the attribute set
i - the value

setLineSpacing

public static void setLineSpacing(MutableAttributeSet a,
                                  float i)
Sets line spacing.

Parameters:
a - the attribute set
i - the value

setRightIndent

public static void setRightIndent(MutableAttributeSet a,
                                  float i)
Sets right indent.

Parameters:
a - the attribute set
i - the value

setSpaceAbove

public static void setSpaceAbove(MutableAttributeSet a,
                                 float i)
Sets space above.

Parameters:
a - the attribute set
i - the value

setSpaceBelow

public static void setSpaceBelow(MutableAttributeSet a,
                                 float i)
Sets space below.

Parameters:
a - the attribute set
i - the value

setStrikeThrough

public static void setStrikeThrough(MutableAttributeSet a,
                                    boolean b)
Sets the strikethrough attribute.

Parameters:
a - the attribute set
b - specifies true/false for setting the attribute

setSubscript

public static void setSubscript(MutableAttributeSet a,
                                boolean b)
Sets the subscript attribute.

Parameters:
a - the attribute set
b - specifies true/false for setting the attribute

setSuperscript

public static void setSuperscript(MutableAttributeSet a,
                                  boolean b)
Sets the superscript attribute.

Parameters:
a - the attribute set
b - specifies true/false for setting the attribute

setTabSet

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

Parameters:
a - the attribute set.
tabs - the TabSet

setUnderline

public static void setUnderline(MutableAttributeSet a,
                                boolean b)
Sets the underline attribute.

Parameters:
a - the attribute set
b - specifies true/false for setting the attribute

toString

public String toString()
Returns the string representation.

Overrides:
toString in class Object
Returns:
the string


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.