Class 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.
Nested Class Summary
Modifier and Type | Class | Description |
---|---|---|
static class |
StyleConstants.CharacterConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a character style. |
static class |
StyleConstants.ColorConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a color. |
static class |
StyleConstants.FontConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a font. |
static class |
StyleConstants.ParagraphConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a paragraph style. |
Field Summary
Modifier and Type | Field | Description |
---|---|---|
static final int |
ALIGN_CENTER |
A possible value for paragraph alignment. |
static final int |
ALIGN_JUSTIFIED |
A possible value for paragraph alignment. |
static final int |
ALIGN_LEFT |
A possible value for paragraph alignment. |
static final int |
ALIGN_RIGHT |
A possible value for paragraph alignment. |
static final Object |
Alignment |
Alignment for the paragraph. |
static final Object |
Background |
Name of the background color attribute. |
static final Object |
BidiLevel |
Bidirectional level of a character as assigned by the Unicode bidi algorithm. |
static final Object |
Bold |
Name of the bold attribute. |
static final Object |
ComponentAttribute |
Name of the component attribute. |
static final String |
ComponentElementName |
Name of elements used to represent components. |
static final Object |
ComposedTextAttribute |
Name of the input method composed text attribute. |
static final Object |
Family |
Name of the font family. |
static final Object |
FirstLineIndent |
The amount of space to indent the first line of the paragraph. |
static final Object |
FontFamily |
Name of the font family. |
static final Object |
FontSize |
Name of the font size. |
static final Object |
Foreground |
Name of the foreground color attribute. |
static final Object |
IconAttribute |
Name of the icon attribute. |
static final String |
IconElementName |
Name of elements used to represent icons. |
static final Object |
Italic |
Name of the italic attribute. |
static final Object |
LeftIndent |
The amount to indent the left side of the paragraph. |
static final Object |
LineSpacing |
The amount of space between lines of the paragraph. |
static final Object |
ModelAttribute |
Attribute used to identify the model for embedded objects that have a model view separation. |
static final Object |
NameAttribute |
Attribute name used to name the collection of attributes. |
static final Object |
Orientation |
Orientation for a paragraph. |
static final Object |
ResolveAttribute |
Attribute name used to identify the resolving parent set of attributes, if one is defined. |
static final Object |
RightIndent |
The amount to indent the right side of the paragraph. |
static final Object |
Size |
Name of the font size. |
static final Object |
SpaceAbove |
The amount of space above the paragraph. |
static final Object |
SpaceBelow |
The amount of space below the paragraph. |
static final Object |
StrikeThrough |
Name of the Strikethrough attribute. |
static final Object |
Subscript |
Name of the Subscript attribute. |
static final Object |
Superscript |
Name of the Superscript attribute. |
static final Object |
TabSet |
TabSet for the paragraph, type is a TabSet containing TabStops. |
static final Object |
Underline |
Name of the underline attribute. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
static int |
getAlignment |
Gets the alignment setting. |
static Color |
getBackground |
Gets the background color setting from the attribute list. |
static int |
getBidiLevel |
Gets the BidiLevel setting. |
static Component |
getComponent |
Gets the component setting from the attribute list. |
static float |
getFirstLineIndent |
Gets the first line indent setting. |
static String |
getFontFamily |
Gets the font family setting from the attribute list. |
static int |
getFontSize |
Gets the font size setting from the attribute list. |
static Color |
getForeground |
Gets the foreground color setting from the attribute list. |
static Icon |
getIcon |
Gets the icon setting from the attribute list. |
static float |
getLeftIndent |
Gets the left indent setting. |
static float |
getLineSpacing |
Gets the line spacing setting. |
static float |
getRightIndent |
Gets the right indent setting. |
static float |
getSpaceAbove |
Gets the space above setting. |
static float |
getSpaceBelow |
Gets the space below setting. |
static TabSet |
getTabSet |
Gets the TabSet. |
static boolean |
isBold |
Checks whether the bold attribute is set. |
static boolean |
isItalic |
Checks whether the italic attribute is set. |
static boolean |
isStrikeThrough |
Checks whether the strikethrough attribute is set. |
static boolean |
isSubscript |
Checks whether the subscript attribute is set. |
static boolean |
isSuperscript |
Checks whether the superscript attribute is set. |
static boolean |
isUnderline |
Checks whether the underline attribute is set. |
static void |
setAlignment |
Sets alignment. |
static void |
setBackground |
Sets the background color. |
static void |
setBidiLevel |
Sets the BidiLevel. |
static void |
setBold |
Sets the bold attribute. |
static void |
setComponent |
Sets the component attribute. |
static void |
setFirstLineIndent |
Sets the first line indent. |
static void |
setFontFamily |
Sets the font attribute. |
static void |
setFontSize |
Sets the font size attribute. |
static void |
setForeground |
Sets the foreground color. |
static void |
setIcon |
Sets the icon attribute. |
static void |
setItalic |
Sets the italic attribute. |
static void |
setLeftIndent |
Sets left indent. |
static void |
setLineSpacing |
Sets line spacing. |
static void |
setRightIndent |
Sets right indent. |
static void |
setSpaceAbove |
Sets space above. |
static void |
setSpaceBelow |
Sets space below. |
static void |
setStrikeThrough |
Sets the strikethrough attribute. |
static void |
setSubscript |
Sets the subscript attribute. |
static void |
setSuperscript |
Sets the superscript attribute. |
static void |
setTabSet |
Sets the TabSet. |
static void |
setUnderline |
Sets the underline attribute. |
String |
toString() |
Returns the string representation. |
Field Details
ComponentElementName
public static final String ComponentElementName
- See Also:
IconElementName
public static final String IconElementName
- See Also:
NameAttribute
public static final Object NameAttribute
ResolveAttribute
public static final Object ResolveAttribute
ModelAttribute
public static final Object ModelAttribute
BidiLevel
public static final Object BidiLevel
FontFamily
public static final Object FontFamily
Family
public static final Object Family
- Since:
- 1.5
FontSize
public static final Object FontSize
Size
public static final Object Size
- Since:
- 1.5
Bold
public static final Object Bold
Italic
public static final Object Italic
Underline
public static final Object Underline
StrikeThrough
public static final Object StrikeThrough
Superscript
public static final Object Superscript
Subscript
public static final Object Subscript
Foreground
public static final Object Foreground
Background
public static final Object Background
ComponentAttribute
public static final Object ComponentAttribute
IconAttribute
public static final Object IconAttribute
ComposedTextAttribute
public static final Object ComposedTextAttribute
FirstLineIndent
public static final Object FirstLineIndent
LeftIndent
public static final Object LeftIndent
RightIndent
public static final Object RightIndent
LineSpacing
public static final Object LineSpacing
SpaceAbove
public static final Object SpaceAbove
SpaceBelow
public static final Object SpaceBelow
Alignment
public static final Object Alignment
- ALIGN_LEFT
- ALIGN_RIGHT
- ALIGN_CENTER
- ALIGN_JUSTIFED
TabSet
public static final Object TabSet
Orientation
public static final Object Orientation
ALIGN_LEFT
public static final int ALIGN_LEFT
- See Also:
ALIGN_CENTER
public static final int ALIGN_CENTER
- See Also:
ALIGN_RIGHT
public static final int ALIGN_RIGHT
- See Also:
ALIGN_JUSTIFIED
public static final int ALIGN_JUSTIFIED
- See Also:
Method Details
toString
public String toString()
getBidiLevel
public static int getBidiLevel(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value
setBidiLevel
public static void setBidiLevel(MutableAttributeSet a, int o)
- Parameters:
-
a
- the attribute set -
o
- the bidi level value
getComponent
public static Component getComponent(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the component, null if none
setComponent
public static void setComponent(MutableAttributeSet a, Component c)
- Parameters:
-
a
- the attribute set -
c
- the component
getIcon
public static Icon getIcon(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the icon, null if none
setIcon
public static void setIcon(MutableAttributeSet a, Icon c)
- Parameters:
-
a
- the attribute set -
c
- the icon
getFontFamily
public static String getFontFamily(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the font family, "Monospaced" as the default
setFontFamily
public static void setFontFamily(MutableAttributeSet a, String fam)
- Parameters:
-
a
- the attribute set -
fam
- the font
getFontSize
public static int getFontSize(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the font size, 12 as the default
setFontSize
public static void setFontSize(MutableAttributeSet a, int s)
- Parameters:
-
a
- the attribute set -
s
- the font size
isBold
public static boolean isBold(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- true if set else false
setBold
public static void setBold(MutableAttributeSet a, boolean b)
- Parameters:
-
a
- the attribute set -
b
- specifies true/false for setting the attribute
isItalic
public static boolean isItalic(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- true if set else false
setItalic
public static void setItalic(MutableAttributeSet a, boolean b)
- Parameters:
-
a
- the attribute set -
b
- specifies true/false for setting the attribute
isUnderline
public static boolean isUnderline(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- true if set else false
isStrikeThrough
public static boolean isStrikeThrough(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- true if set else false
isSuperscript
public static boolean isSuperscript(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- true if set else false
isSubscript
public static boolean isSubscript(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- true if set else false
setUnderline
public static void setUnderline(MutableAttributeSet a, boolean b)
- Parameters:
-
a
- the attribute set -
b
- specifies true/false for setting the attribute
setStrikeThrough
public static void setStrikeThrough(MutableAttributeSet a, boolean b)
- Parameters:
-
a
- the attribute set -
b
- specifies true/false for setting the attribute
setSuperscript
public static void setSuperscript(MutableAttributeSet a, boolean b)
- Parameters:
-
a
- the attribute set -
b
- specifies true/false for setting the attribute
setSubscript
public static void setSubscript(MutableAttributeSet a, boolean b)
- Parameters:
-
a
- the attribute set -
b
- specifies true/false for setting the attribute
getForeground
public static Color getForeground(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the color, Color.black as the default
setForeground
public static void setForeground(MutableAttributeSet a, Color fg)
- Parameters:
-
a
- the attribute set -
fg
- the color
getBackground
public static Color getBackground(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the color, Color.black as the default
setBackground
public static void setBackground(MutableAttributeSet a, Color fg)
- Parameters:
-
a
- the attribute set -
fg
- the color
getFirstLineIndent
public static float getFirstLineIndent(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value, 0 if not set
setFirstLineIndent
public static void setFirstLineIndent(MutableAttributeSet a, float i)
- Parameters:
-
a
- the attribute set -
i
- the value
getRightIndent
public static float getRightIndent(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value, 0 if not set
setRightIndent
public static void setRightIndent(MutableAttributeSet a, float i)
- Parameters:
-
a
- the attribute set -
i
- the value
getLeftIndent
public static float getLeftIndent(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value, 0 if not set
setLeftIndent
public static void setLeftIndent(MutableAttributeSet a, float i)
- Parameters:
-
a
- the attribute set -
i
- the value
getLineSpacing
public static float getLineSpacing(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value, 0 if not set
setLineSpacing
public static void setLineSpacing(MutableAttributeSet a, float i)
- Parameters:
-
a
- the attribute set -
i
- the value
getSpaceAbove
public static float getSpaceAbove(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value, 0 if not set
setSpaceAbove
public static void setSpaceAbove(MutableAttributeSet a, float i)
- Parameters:
-
a
- the attribute set -
i
- the value
getSpaceBelow
public static float getSpaceBelow(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value, 0 if not set
setSpaceBelow
public static void setSpaceBelow(MutableAttributeSet a, float i)
- Parameters:
-
a
- the attribute set -
i
- the value
getAlignment
public static int getAlignment(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the value
StyleConstants.ALIGN_LEFT
if not set
setAlignment
public static void setAlignment(MutableAttributeSet a, int align)
- Parameters:
-
a
- the attribute set -
align
- the alignment value
getTabSet
public static TabSet getTabSet(AttributeSet a)
- Parameters:
-
a
- the attribute set - Returns:
- the
TabSet
setTabSet
public static void setTabSet(MutableAttributeSet a, TabSet tabs)
- Parameters:
-
a
- the attribute set. -
tabs
- the TabSet
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/text/StyleConstants.html