StyleConstants.CharacterConstants
, StyleConstants.ColorConstants
, StyleConstants.FontConstants
, StyleConstants.ParagraphConstants
public sealed class StyleConstants extends Object permits 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.
Modifier and Type | Class | Description |
---|---|---|
static final class |
StyleConstants.CharacterConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a character style. |
static final class |
StyleConstants.ColorConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a color. |
static final class |
StyleConstants.FontConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a font. |
static final class |
StyleConstants.ParagraphConstants |
This is a typesafe enumeration of the well-known attributes that contribute to a paragraph style. |
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. |
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. |
public static final String ComponentElementName
public static final String IconElementName
public static final Object NameAttribute
public static final Object ResolveAttribute
public static final Object ModelAttribute
public static final Object BidiLevel
public static final Object FontFamily
public static final Object Family
public static final Object FontSize
public static final Object Size
public static final Object Bold
public static final Object Italic
public static final Object Underline
public static final Object StrikeThrough
public static final Object Superscript
public static final Object Subscript
public static final Object Foreground
public static final Object Background
public static final Object ComponentAttribute
public static final Object IconAttribute
public static final Object ComposedTextAttribute
public static final Object FirstLineIndent
public static final Object LeftIndent
public static final Object RightIndent
public static final Object LineSpacing
public static final Object SpaceAbove
public static final Object SpaceBelow
public static final Object Alignment
public static final Object TabSet
public static final Object Orientation
public static final int ALIGN_LEFT
public static final int ALIGN_CENTER
public static final int ALIGN_RIGHT
public static final int ALIGN_JUSTIFIED
public String toString()
public static int getBidiLevel(AttributeSet a)
a
- the attribute setpublic static void setBidiLevel(MutableAttributeSet a, int o)
a
- the attribute seto
- the bidi level valuepublic static Component getComponent(AttributeSet a)
a
- the attribute setpublic static void setComponent(MutableAttributeSet a, Component c)
a
- the attribute setc
- the componentpublic static Icon getIcon(AttributeSet a)
a
- the attribute setpublic static void setIcon(MutableAttributeSet a, Icon c)
a
- the attribute setc
- the iconpublic static String getFontFamily(AttributeSet a)
a
- the attribute setpublic static void setFontFamily(MutableAttributeSet a, String fam)
a
- the attribute setfam
- the fontpublic static int getFontSize(AttributeSet a)
a
- the attribute setpublic static void setFontSize(MutableAttributeSet a, int s)
a
- the attribute sets
- the font sizepublic static boolean isBold(AttributeSet a)
a
- the attribute setpublic static void setBold(MutableAttributeSet a, boolean b)
a
- the attribute setb
- specifies true/false for setting the attributepublic static boolean isItalic(AttributeSet a)
a
- the attribute setpublic static void setItalic(MutableAttributeSet a, boolean b)
a
- the attribute setb
- specifies true/false for setting the attributepublic static boolean isUnderline(AttributeSet a)
a
- the attribute setpublic static boolean isStrikeThrough(AttributeSet a)
a
- the attribute setpublic static boolean isSuperscript(AttributeSet a)
a
- the attribute setpublic static boolean isSubscript(AttributeSet a)
a
- the attribute setpublic static void setUnderline(MutableAttributeSet a, boolean b)
a
- the attribute setb
- specifies true/false for setting the attributepublic static void setStrikeThrough(MutableAttributeSet a, boolean b)
a
- the attribute setb
- specifies true/false for setting the attributepublic static void setSuperscript(MutableAttributeSet a, boolean b)
a
- the attribute setb
- specifies true/false for setting the attributepublic static void setSubscript(MutableAttributeSet a, boolean b)
a
- the attribute setb
- specifies true/false for setting the attributepublic static Color getForeground(AttributeSet a)
a
- the attribute setpublic static void setForeground(MutableAttributeSet a, Color fg)
a
- the attribute setfg
- the colorpublic static Color getBackground(AttributeSet a)
a
- the attribute setpublic static void setBackground(MutableAttributeSet a, Color fg)
a
- the attribute setfg
- the colorpublic static float getFirstLineIndent(AttributeSet a)
a
- the attribute setpublic static void setFirstLineIndent(MutableAttributeSet a, float i)
a
- the attribute seti
- the valuepublic static float getRightIndent(AttributeSet a)
a
- the attribute setpublic static void setRightIndent(MutableAttributeSet a, float i)
a
- the attribute seti
- the valuepublic static float getLeftIndent(AttributeSet a)
a
- the attribute setpublic static void setLeftIndent(MutableAttributeSet a, float i)
a
- the attribute seti
- the valuepublic static float getLineSpacing(AttributeSet a)
a
- the attribute setpublic static void setLineSpacing(MutableAttributeSet a, float i)
a
- the attribute seti
- the valuepublic static float getSpaceAbove(AttributeSet a)
a
- the attribute setpublic static void setSpaceAbove(MutableAttributeSet a, float i)
a
- the attribute seti
- the valuepublic static float getSpaceBelow(AttributeSet a)
a
- the attribute setpublic static void setSpaceBelow(MutableAttributeSet a, float i)
a
- the attribute seti
- the valuepublic static int getAlignment(AttributeSet a)
a
- the attribute setStyleConstants.ALIGN_LEFT
if not setpublic static void setAlignment(MutableAttributeSet a, int align)
a
- the attribute setalign
- the alignment valuepublic static TabSet getTabSet(AttributeSet a)
a
- the attribute setTabSet
public static void setTabSet(MutableAttributeSet a, TabSet tabs)
a
- the attribute set.tabs
- the TabSet
© 1993, 2023, 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/21/docs/api/java.desktop/javax/swing/text/StyleConstants.html