summaryrefslogtreecommitdiff
path: root/javax
diff options
context:
space:
mode:
authorDavid Gilbert <david.gilbert@object-refinery.com>2006-01-16 15:59:47 +0000
committerDavid Gilbert <david.gilbert@object-refinery.com>2006-01-16 15:59:47 +0000
commitc696667f69cdd44505e0c34b217be1c883be68fa (patch)
treedb978a9c15f947a5a8088a68699e3d5f8a5be68d /javax
parent77ae61fbd2f7a957448fd46974409d230de85a79 (diff)
downloadclasspath-c696667f69cdd44505e0c34b217be1c883be68fa.tar.gz
2006-01-16 David Gilbert <david.gilbert@object-refinery.com>
* javax/swing/text/StyleConstants.java: Updated API docs all over.
Diffstat (limited to 'javax')
-rw-r--r--javax/swing/text/StyleConstants.java617
1 files changed, 609 insertions, 8 deletions
diff --git a/javax/swing/text/StyleConstants.java b/javax/swing/text/StyleConstants.java
index 598eaf621..da99c6420 100644
--- a/javax/swing/text/StyleConstants.java
+++ b/javax/swing/text/StyleConstants.java
@@ -1,5 +1,5 @@
/* StyleConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,45 +43,124 @@ import java.awt.Component;
import javax.swing.Icon;
+/**
+ * Represents standard attribute keys. This class also contains a set of
+ * useful static utility methods for querying and populating an
+ * {@link AttributeSet}.
+ *
+ * @since 1.2
+ */
public class StyleConstants
{
+ /**
+ * A value representing left alignment for the
+ * {@link ParagraphConstants#Alignment} attribute.
+ */
public static final int ALIGN_LEFT = 0;
+
+ /**
+ * A value representing center alignment for the
+ * {@link ParagraphConstants#Alignment} attribute.
+ */
public static final int ALIGN_CENTER = 1;
+
+ /**
+ * A value representing right alignment for the
+ * {@link ParagraphConstants#Alignment} attribute.
+ */
public static final int ALIGN_RIGHT = 2;
+
+ /**
+ * A value representing ful justification for the
+ * {@link ParagraphConstants#Alignment} attribute.
+ */
public static final int ALIGN_JUSTIFIED = 3;
+ /** An alias for {@link CharacterConstants#Background}. */
public static final Object Background = CharacterConstants.Background;
+
+ /** An alias for {@link CharacterConstants#BidiLevel}. */
public static final Object BidiLevel = CharacterConstants.BidiLevel;
+
+ /** An alias for {@link CharacterConstants#Bold}. */
public static final Object Bold = CharacterConstants.Bold;
- public static final Object ComponentAttribute = CharacterConstants.ComponentAttribute;
+
+ /** An alias for {@link CharacterConstants#ComponentAttribute}. */
+ public static final Object ComponentAttribute
+ = CharacterConstants.ComponentAttribute;
+
+ /** An alias for {@link CharacterConstants#Family}. */
public static final Object Family = CharacterConstants.Family;
+
+ /** An alias for {@link CharacterConstants#Family}. */
public static final Object FontFamily = CharacterConstants.Family;
+
+ /** An alias for {@link CharacterConstants#Size}. */
public static final Object FontSize = CharacterConstants.Size;
+
+ /** An alias for {@link CharacterConstants#Foreground}. */
public static final Object Foreground = CharacterConstants.Foreground;
+
+ /** An alias for {@link CharacterConstants#IconAttribute}. */
public static final Object IconAttribute = CharacterConstants.IconAttribute;
+
+ /** An alias for {@link CharacterConstants#Italic}. */
public static final Object Italic = CharacterConstants.Italic;
+
+ /** An alias for {@link CharacterConstants#Size}. */
public static final Object Size = CharacterConstants.Size;
+
+ /** An alias for {@link CharacterConstants#StrikeThrough}. */
public static final Object StrikeThrough = CharacterConstants.StrikeThrough;
+
+ /** An alias for {@link CharacterConstants#Subscript}. */
public static final Object Subscript = CharacterConstants.Subscript;
+
+ /** An alias for {@link CharacterConstants#Superscript}. */
public static final Object Superscript = CharacterConstants.Superscript;
+
+ /** An alias for {@link CharacterConstants#Underline}. */
public static final Object Underline = CharacterConstants.Underline;
+ /** An alias for {@link ParagraphConstants#Alignment}. */
public static final Object Alignment = ParagraphConstants.Alignment;
- public static final Object FirstLineIndent = ParagraphConstants.FirstLineIndent;
+
+ /** An alias for {@link ParagraphConstants#FirstLineIndent}. */
+ public static final Object FirstLineIndent
+ = ParagraphConstants.FirstLineIndent;
+
+ /** An alias for {@link ParagraphConstants#LeftIndent}. */
public static final Object LeftIndent = ParagraphConstants.LeftIndent;
+
+ /** An alias for {@link ParagraphConstants#LineSpacing}. */
public static final Object LineSpacing = ParagraphConstants.LineSpacing;
+
+ /** An alias for {@link ParagraphConstants#Orientation}. */
public static final Object Orientation = ParagraphConstants.Orientation;
+
+ /** An alias for {@link ParagraphConstants#RightIndent}. */
public static final Object RightIndent = ParagraphConstants.RightIndent;
+
+ /** An alias for {@link ParagraphConstants#SpaceAbove}. */
public static final Object SpaceAbove = ParagraphConstants.SpaceAbove;
+
+ /** An alias for {@link ParagraphConstants#SpaceBelow}. */
public static final Object SpaceBelow = ParagraphConstants.SpaceBelow;
+
+ /** An alias for {@link ParagraphConstants#TabSet}. */
public static final Object TabSet = ParagraphConstants.TabSet;
public static final String ComponentElementName = "component";
+
public static final String IconElementName = "icon";
- public static final Object ComposedTextAttribute = new StyleConstants("composed text");
+ public static final Object ComposedTextAttribute
+ = new StyleConstants("composed text");
+
public static final Object ModelAttribute = new StyleConstants("model");
+
public static final Object NameAttribute = new StyleConstants("name");
+
public static final Object ResolveAttribute = new StyleConstants("resolver");
String keyname;
@@ -93,11 +172,28 @@ public class StyleConstants
keyname = k;
}
+ /**
+ * Returns a string representation of the attribute key.
+ *
+ * @return A string representation of the attribute key.
+ */
public String toString()
{
return keyname;
}
+ /**
+ * Returns the alignment specified in the given attributes, or
+ * {@link #ALIGN_LEFT} if no alignment is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The alignment (typically one of {@link #ALIGN_LEFT},
+ * {@link #ALIGN_RIGHT}, {@link #ALIGN_CENTER} or
+ * {@link #ALIGN_JUSTIFIED}).
+ *
+ * @see #setAlignment(MutableAttributeSet, int)
+ */
public static int getAlignment(AttributeSet a)
{
if (a.isDefined(Alignment))
@@ -106,6 +202,16 @@ public class StyleConstants
return ALIGN_LEFT;
}
+ /**
+ * Returns the background color specified in the given attributes, or
+ * {@link Color#BLACK} if no background color is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The background color.
+ *
+ * @see #setBackground(MutableAttributeSet, Color)
+ */
public static Color getBackground(AttributeSet a)
{
if (a.isDefined(Background))
@@ -113,7 +219,17 @@ public class StyleConstants
else
return Color.WHITE;
}
-
+
+ /**
+ * Returns the bidi level specified in the given attributes, or
+ * <code>0</code> if no bidi level is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The bidi level.
+ *
+ * @see #setBidiLevel(MutableAttributeSet, int)
+ */
public static int getBidiLevel(AttributeSet a)
{
if (a.isDefined(BidiLevel))
@@ -122,6 +238,16 @@ public class StyleConstants
return 0;
}
+ /**
+ * Returns the component specified in the given attributes, or
+ * <code>null</code> if no component is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The component (possibly <code>null</code>).
+ *
+ * @see #setComponent(MutableAttributeSet, Component)
+ */
public static Component getComponent(AttributeSet a)
{
if (a.isDefined(ComponentAttribute))
@@ -130,6 +256,16 @@ public class StyleConstants
return (Component) null;
}
+ /**
+ * Returns the indentation specified in the given attributes, or
+ * <code>0.0f</code> if no indentation is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The indentation.
+ *
+ * @see #setFirstLineIndent(MutableAttributeSet, float)
+ */
public static float getFirstLineIndent(AttributeSet a)
{
if (a.isDefined(FirstLineIndent))
@@ -138,6 +274,16 @@ public class StyleConstants
return 0.f;
}
+ /**
+ * Returns the font family specified in the given attributes, or
+ * <code>Monospaced</code> if no font family is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The font family.
+ *
+ * @see #setFontFamily(MutableAttributeSet, String)
+ */
public static String getFontFamily(AttributeSet a)
{
if (a.isDefined(FontFamily))
@@ -146,6 +292,16 @@ public class StyleConstants
return "Monospaced";
}
+ /**
+ * Returns the font size specified in the given attributes, or
+ * <code>12</code> if no font size is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The font size.
+ *
+ * @see #setFontSize(MutableAttributeSet, int)
+ */
public static int getFontSize(AttributeSet a)
{
if (a.isDefined(FontSize))
@@ -154,6 +310,16 @@ public class StyleConstants
return 12;
}
+ /**
+ * Returns the foreground color specified in the given attributes, or
+ * {@link Color#BLACK} if no foreground color is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The foreground color.
+ *
+ * @see #setForeground(MutableAttributeSet, Color)
+ */
public static Color getForeground(AttributeSet a)
{
if (a.isDefined(Foreground))
@@ -162,6 +328,16 @@ public class StyleConstants
return Color.BLACK;
}
+ /**
+ * Returns the icon specified in the given attributes, or
+ * <code>null</code> if no icon is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The icon (possibly <code>null</code>).
+ *
+ * @see #setIcon(MutableAttributeSet, Icon)
+ */
public static Icon getIcon(AttributeSet a)
{
if (a.isDefined(IconAttribute))
@@ -170,6 +346,16 @@ public class StyleConstants
return (Icon) null;
}
+ /**
+ * Returns the left indentation specified in the given attributes, or
+ * <code>0.0f</code> if no left indentation is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The left indentation.
+ *
+ * @see #setLeftIndent(MutableAttributeSet, float)
+ */
public static float getLeftIndent(AttributeSet a)
{
if (a.isDefined(LeftIndent))
@@ -178,6 +364,16 @@ public class StyleConstants
return 0.f;
}
+ /**
+ * Returns the line spacing specified in the given attributes, or
+ * <code>0.0f</code> if no line spacing is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The line spacing.
+ *
+ * @see #setLineSpacing(MutableAttributeSet, float)
+ */
public static float getLineSpacing(AttributeSet a)
{
if (a.isDefined(LineSpacing))
@@ -186,6 +382,16 @@ public class StyleConstants
return 0.f;
}
+ /**
+ * Returns the right indentation specified in the given attributes, or
+ * <code>0.0f</code> if no right indentation is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The right indentation.
+ *
+ * @see #setRightIndent(MutableAttributeSet, float)
+ */
public static float getRightIndent(AttributeSet a)
{
if (a.isDefined(RightIndent))
@@ -194,6 +400,16 @@ public class StyleConstants
return 0.f;
}
+ /**
+ * Returns the 'space above' specified in the given attributes, or
+ * <code>0.0f</code> if no 'space above' is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The 'space above'.
+ *
+ * @see #setSpaceAbove(MutableAttributeSet, float)
+ */
public static float getSpaceAbove(AttributeSet a)
{
if (a.isDefined(SpaceAbove))
@@ -202,6 +418,16 @@ public class StyleConstants
return 0.f;
}
+ /**
+ * Returns the 'space below' specified in the given attributes, or
+ * <code>0.0f</code> if no 'space below' is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The 'space below'.
+ *
+ * @see #setSpaceBelow(MutableAttributeSet, float)
+ */
public static float getSpaceBelow(AttributeSet a)
{
if (a.isDefined(SpaceBelow))
@@ -210,6 +436,16 @@ public class StyleConstants
return 0.f;
}
+ /**
+ * Returns the tab set specified in the given attributes, or
+ * <code>null</code> if no tab set is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The tab set.
+ *
+ * @see #setTabSet(MutableAttributeSet, javax.swing.text.TabSet)
+ */
public static javax.swing.text.TabSet getTabSet(AttributeSet a)
{
if (a.isDefined(StyleConstants.TabSet))
@@ -218,6 +454,16 @@ public class StyleConstants
return (javax.swing.text.TabSet) null;
}
+ /**
+ * Returns the value of the bold flag in the given attributes, or
+ * <code>false</code> if no bold flag is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The bold flag.
+ *
+ * @see #setBold(MutableAttributeSet, boolean)
+ */
public static boolean isBold(AttributeSet a)
{
if (a.isDefined(Bold))
@@ -226,6 +472,16 @@ public class StyleConstants
return false;
}
+ /**
+ * Returns the value of the italic flag in the given attributes, or
+ * <code>false</code> if no italic flag is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The italic flag.
+ *
+ * @see #setItalic(MutableAttributeSet, boolean)
+ */
public static boolean isItalic(AttributeSet a)
{
if (a.isDefined(Italic))
@@ -234,6 +490,16 @@ public class StyleConstants
return false;
}
+ /**
+ * Returns the value of the strike-through flag in the given attributes, or
+ * <code>false</code> if no strike-through flag is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The strike-through flag.
+ *
+ * @see #setStrikeThrough(MutableAttributeSet, boolean)
+ */
public static boolean isStrikeThrough(AttributeSet a)
{
if (a.isDefined(StrikeThrough))
@@ -242,6 +508,16 @@ public class StyleConstants
return false;
}
+ /**
+ * Returns the value of the subscript flag in the given attributes, or
+ * <code>false</code> if no subscript flag is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The subscript flag.
+ *
+ * @see #setSubscript(MutableAttributeSet, boolean)
+ */
public static boolean isSubscript(AttributeSet a)
{
if (a.isDefined(Subscript))
@@ -250,6 +526,16 @@ public class StyleConstants
return false;
}
+ /**
+ * Returns the value of the superscript flag in the given attributes, or
+ * <code>false</code> if no superscript flag is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The superscript flag.
+ *
+ * @see #setSuperscript(MutableAttributeSet, boolean)
+ */
public static boolean isSuperscript(AttributeSet a)
{
if (a.isDefined(Superscript))
@@ -258,6 +544,16 @@ public class StyleConstants
return false;
}
+ /**
+ * Returns the value of the underline flag in the given attributes, or
+ * <code>false</code> if no underline flag is specified.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ *
+ * @return The underline flag.
+ *
+ * @see #setUnderline(MutableAttributeSet, boolean)
+ */
public static boolean isUnderline(AttributeSet a)
{
if (a.isDefined(Underline))
@@ -266,106 +562,320 @@ public class StyleConstants
return false;
}
+ /**
+ * Adds an alignment attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param align the alignment (typically one of
+ * {@link StyleConstants#ALIGN_LEFT},
+ * {@link StyleConstants#ALIGN_RIGHT},
+ * {@link StyleConstants#ALIGN_CENTER} or
+ * {@link StyleConstants#ALIGN_JUSTIFIED}).
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getAlignment(AttributeSet)
+ */
public static void setAlignment(MutableAttributeSet a, int align)
{
a.addAttribute(Alignment, new Integer(align));
}
- public static void setBackground(MutableAttributeSet a, Color fg)
+ /**
+ * Adds a background attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param bg the background (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ *
+ * @see #getBackground(AttributeSet)
+ */
+ public static void setBackground(MutableAttributeSet a, Color bg)
{
- a.addAttribute(Background, fg);
+ a.addAttribute(Background, bg);
}
+ /**
+ * Adds a bidi-level attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param lev the level.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getBidiLevel(AttributeSet)
+ */
public static void setBidiLevel(MutableAttributeSet a, int lev)
{
a.addAttribute(BidiLevel, new Integer(lev));
}
+ /**
+ * Adds a bold attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param b the new value of the bold attribute.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #isBold(AttributeSet)
+ */
public static void setBold(MutableAttributeSet a, boolean b)
{
a.addAttribute(Bold, Boolean.valueOf(b));
}
+ /**
+ * Adds a component attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param c the component (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ *
+ * @see #getComponent(AttributeSet)
+ */
public static void setComponent(MutableAttributeSet a, Component c)
{
a.addAttribute(ComponentAttribute, c);
}
+ /**
+ * Adds a first line indentation attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param i the indentation.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getFirstLineIndent(AttributeSet)
+ */
public static void setFirstLineIndent(MutableAttributeSet a, float i)
{
a.addAttribute(FirstLineIndent, new Float(i));
}
+ /**
+ * Adds a font family attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param fam the font family name (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ *
+ * @see #getFontFamily(AttributeSet)
+ */
public static void setFontFamily(MutableAttributeSet a, String fam)
{
a.addAttribute(FontFamily, fam);
}
+ /**
+ * Adds a font size attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param s the font size (in points).
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getFontSize(AttributeSet)
+ */
public static void setFontSize(MutableAttributeSet a, int s)
{
a.addAttribute(FontSize, new Integer(s));
}
+ /**
+ * Adds a foreground color attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param fg the foreground color (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ *
+ * @see #getForeground(AttributeSet)
+ */
public static void setForeground(MutableAttributeSet a, Color fg)
{
a.addAttribute(Foreground, fg);
}
+ /**
+ * Adds an icon attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param c the icon (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ *
+ * @see #getIcon(AttributeSet)
+ */
public static void setIcon(MutableAttributeSet a, Icon c)
{
a.addAttribute(IconAttribute, c);
}
+ /**
+ * Adds an italic attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param b the new value of the italic attribute.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #isItalic(AttributeSet)
+ */
public static void setItalic(MutableAttributeSet a, boolean b)
{
a.addAttribute(Italic, Boolean.valueOf(b));
}
+ /**
+ * Adds a left indentation attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param i the indentation.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getLeftIndent(AttributeSet)
+ */
public static void setLeftIndent(MutableAttributeSet a, float i)
{
a.addAttribute(LeftIndent, new Float(i));
}
+ /**
+ * Adds a line spacing attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param i the line spacing.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getLineSpacing(AttributeSet)
+ */
public static void setLineSpacing(MutableAttributeSet a, float i)
{
a.addAttribute(LineSpacing, new Float(i));
}
+ /**
+ * Adds a right indentation attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param i the right indentation.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getRightIndent(AttributeSet)
+ */
public static void setRightIndent(MutableAttributeSet a, float i)
{
a.addAttribute(RightIndent, new Float(i));
}
+ /**
+ * Adds a 'space above' attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param i the space above attribute value.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getSpaceAbove(AttributeSet)
+ */
public static void setSpaceAbove(MutableAttributeSet a, float i)
{
a.addAttribute(SpaceAbove, new Float(i));
}
+ /**
+ * Adds a 'space below' attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param i the space below attribute value.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #getSpaceBelow(AttributeSet)
+ */
public static void setSpaceBelow(MutableAttributeSet a, float i)
{
a.addAttribute(SpaceBelow, new Float(i));
}
+ /**
+ * Adds a strike-through attribue to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param b the strike-through attribute value.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #isStrikeThrough(AttributeSet)
+ */
public static void setStrikeThrough(MutableAttributeSet a, boolean b)
{
a.addAttribute(StrikeThrough, Boolean.valueOf(b));
}
+ /**
+ * Adds a subscript attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param b the subscript attribute value.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #isSubscript(AttributeSet)
+ */
public static void setSubscript(MutableAttributeSet a, boolean b)
{
a.addAttribute(Subscript, Boolean.valueOf(b));
}
+ /**
+ * Adds a superscript attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param b the superscript attribute value.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #isSuperscript(AttributeSet)
+ */
public static void setSuperscript(MutableAttributeSet a, boolean b)
{
a.addAttribute(Superscript, Boolean.valueOf(b));
}
+ /**
+ * Adds a {@link TabSet} attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param tabs the tab set (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if either argument is <code>null</code>.
+ *
+ * @see #getTabSet(AttributeSet)
+ */
public static void setTabSet(MutableAttributeSet a, javax.swing.text.TabSet tabs)
{
a.addAttribute(StyleConstants.TabSet, tabs);
}
+ /**
+ * Adds an underline attribute to the specified set.
+ *
+ * @param a the attribute set (<code>null</code> not permitted).
+ * @param b the underline attribute value.
+ *
+ * @throws NullPointerException if <code>a</code> is <code>null</code>.
+ *
+ * @see #isUnderline(AttributeSet)
+ */
public static void setUnderline(MutableAttributeSet a, boolean b)
{
a.addAttribute(Underline, Boolean.valueOf(b));
@@ -373,73 +883,164 @@ public class StyleConstants
// The remainder are so-called "typesafe enumerations" which
// alias subsets of the above constants.
+
+ /**
+ * A set of keys for attributes that apply to characters.
+ */
public static class CharacterConstants
extends StyleConstants
implements AttributeSet.CharacterAttribute
{
+ /**
+ * Private constructor prevents new instances being created.
+ *
+ * @param k the key name.
+ */
private CharacterConstants(String k)
{
super(k);
}
+ /** An alias for {@link ColorConstants#Background}. */
public static Object Background = ColorConstants.Background;
+
+ /** A key for the bidi level character attribute. */
public static Object BidiLevel = new CharacterConstants("bidiLevel");
+
+ /** An alias for {@link FontConstants#Bold}. */
public static Object Bold = FontConstants.Bold;
+
+ /** A key for the component character attribute. */
public static Object ComponentAttribute = new CharacterConstants("component");
+
+ /** An alias for {@link FontConstants#Family}. */
public static Object Family = FontConstants.Family;
+
+ /** An alias for {@link FontConstants#Size}. */
public static Object Size = FontConstants.Size;
+
+ /** An alias for {@link ColorConstants#Foreground}. */
public static Object Foreground = ColorConstants.Foreground;
+
+ /** A key for the icon character attribute. */
public static Object IconAttribute = new CharacterConstants("icon");
+
+ /** A key for the italic character attribute. */
public static Object Italic = FontConstants.Italic;
+
+ /** A key for the strike through character attribute. */
public static Object StrikeThrough = new CharacterConstants("strikethrough");
+
+ /** A key for the subscript character attribute. */
public static Object Subscript = new CharacterConstants("subscript");
+
+ /** A key for the superscript character attribute. */
public static Object Superscript = new CharacterConstants("superscript");
+
+ /** A key for the underline character attribute. */
public static Object Underline = new CharacterConstants("underline");
+
}
+ /**
+ * A set of keys for attributes that relate to colors.
+ */
public static class ColorConstants
extends StyleConstants
implements AttributeSet.ColorAttribute, AttributeSet.CharacterAttribute
{
+ /**
+ * Private constructor prevents new instances being created.
+ *
+ * @param k the key name.
+ */
private ColorConstants(String k)
{
super(k);
}
+
+ /** A key for the foreground color attribute. */
public static Object Foreground = new ColorConstants("foreground");
+
+ /** A key for the background color attribute. */
public static Object Background = new ColorConstants("background");
}
+ /**
+ * A set of keys for attributes that apply to fonts.
+ */
public static class FontConstants
extends StyleConstants
implements AttributeSet.FontAttribute, AttributeSet.CharacterAttribute
{
+ /**
+ * Private constructor prevents new instances being created.
+ *
+ * @param k the key name.
+ */
private FontConstants(String k)
{
super(k);
}
+
+ /** A key for the bold font attribute. */
public static Object Bold = new FontConstants("bold");
+
+ /** A key for the family font attribute. */
public static Object Family = new FontConstants("family");
+
+ /** A key for the italic font attribute. */
public static Object Italic = new FontConstants("italic");
+
+ /** A key for the size font attribute. */
public static Object Size = new FontConstants("size");
}
+ /**
+ * A set of keys for attributes that apply to paragraphs.
+ */
public static class ParagraphConstants
extends StyleConstants
implements AttributeSet.ParagraphAttribute
{
+ /**
+ * Private constructor prevents new instances being created.
+ *
+ * @param k the key name.
+ */
private ParagraphConstants(String k)
{
super(k);
}
+
+ /** A key for the alignment paragraph attribute. */
public static Object Alignment = new ParagraphConstants("Alignment");
- public static Object FirstLineIndent = new ParagraphConstants("FirstLineIndent");
+
+ /** A key for the first line indentation paragraph attribute. */
+ public static Object FirstLineIndent
+ = new ParagraphConstants("FirstLineIndent");
+
+ /** A key for the left indentation paragraph attribute. */
public static Object LeftIndent = new ParagraphConstants("LeftIndent");
+
+ /** A key for the line spacing paragraph attribute. */
public static Object LineSpacing = new ParagraphConstants("LineSpacing");
+
+ /** A key for the orientation paragraph attribute. */
public static Object Orientation = new ParagraphConstants("Orientation");
+
+ /** A key for the right indentation paragraph attribute. */
public static Object RightIndent = new ParagraphConstants("RightIndent");
+
+ /** A key for the 'space above' paragraph attribute. */
public static Object SpaceAbove = new ParagraphConstants("SpaceAbove");
+
+ /** A key for the 'space below' paragraph attribute. */
public static Object SpaceBelow = new ParagraphConstants("SpaceBelow");
+
+ /** A key for the tabset paragraph attribute. */
public static Object TabSet = new ParagraphConstants("TabSet");
+
}
}