1 /* StyleConstants.java --
2 Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax
.swing
.text
;
41 import java
.awt
.Color
;
42 import java
.awt
.Component
;
44 import javax
.swing
.Icon
;
47 * Represents standard attribute keys. This class also contains a set of
48 * useful static utility methods for querying and populating an
49 * {@link AttributeSet}.
53 public class StyleConstants
56 * A value representing left alignment for the
57 * {@link ParagraphConstants#Alignment} attribute.
59 public static final int ALIGN_LEFT
= 0;
62 * A value representing center alignment for the
63 * {@link ParagraphConstants#Alignment} attribute.
65 public static final int ALIGN_CENTER
= 1;
68 * A value representing right alignment for the
69 * {@link ParagraphConstants#Alignment} attribute.
71 public static final int ALIGN_RIGHT
= 2;
74 * A value representing ful justification for the
75 * {@link ParagraphConstants#Alignment} attribute.
77 public static final int ALIGN_JUSTIFIED
= 3;
79 /** An alias for {@link CharacterConstants#Background}. */
80 public static final Object Background
= CharacterConstants
.Background
;
82 /** An alias for {@link CharacterConstants#BidiLevel}. */
83 public static final Object BidiLevel
= CharacterConstants
.BidiLevel
;
85 /** An alias for {@link CharacterConstants#Bold}. */
86 public static final Object Bold
= CharacterConstants
.Bold
;
88 /** An alias for {@link CharacterConstants#ComponentAttribute}. */
89 public static final Object ComponentAttribute
90 = CharacterConstants
.ComponentAttribute
;
92 /** An alias for {@link CharacterConstants#Family}. */
93 public static final Object Family
= CharacterConstants
.Family
;
95 /** An alias for {@link CharacterConstants#Family}. */
96 public static final Object FontFamily
= CharacterConstants
.Family
;
98 /** An alias for {@link CharacterConstants#Size}. */
99 public static final Object FontSize
= CharacterConstants
.Size
;
101 /** An alias for {@link CharacterConstants#Foreground}. */
102 public static final Object Foreground
= CharacterConstants
.Foreground
;
104 /** An alias for {@link CharacterConstants#IconAttribute}. */
105 public static final Object IconAttribute
= CharacterConstants
.IconAttribute
;
107 /** An alias for {@link CharacterConstants#Italic}. */
108 public static final Object Italic
= CharacterConstants
.Italic
;
110 /** An alias for {@link CharacterConstants#Size}. */
111 public static final Object Size
= CharacterConstants
.Size
;
113 /** An alias for {@link CharacterConstants#StrikeThrough}. */
114 public static final Object StrikeThrough
= CharacterConstants
.StrikeThrough
;
116 /** An alias for {@link CharacterConstants#Subscript}. */
117 public static final Object Subscript
= CharacterConstants
.Subscript
;
119 /** An alias for {@link CharacterConstants#Superscript}. */
120 public static final Object Superscript
= CharacterConstants
.Superscript
;
122 /** An alias for {@link CharacterConstants#Underline}. */
123 public static final Object Underline
= CharacterConstants
.Underline
;
125 /** An alias for {@link ParagraphConstants#Alignment}. */
126 public static final Object Alignment
= ParagraphConstants
.Alignment
;
128 /** An alias for {@link ParagraphConstants#FirstLineIndent}. */
129 public static final Object FirstLineIndent
130 = ParagraphConstants
.FirstLineIndent
;
132 /** An alias for {@link ParagraphConstants#LeftIndent}. */
133 public static final Object LeftIndent
= ParagraphConstants
.LeftIndent
;
135 /** An alias for {@link ParagraphConstants#LineSpacing}. */
136 public static final Object LineSpacing
= ParagraphConstants
.LineSpacing
;
138 /** An alias for {@link ParagraphConstants#Orientation}. */
139 public static final Object Orientation
= ParagraphConstants
.Orientation
;
141 /** An alias for {@link ParagraphConstants#RightIndent}. */
142 public static final Object RightIndent
= ParagraphConstants
.RightIndent
;
144 /** An alias for {@link ParagraphConstants#SpaceAbove}. */
145 public static final Object SpaceAbove
= ParagraphConstants
.SpaceAbove
;
147 /** An alias for {@link ParagraphConstants#SpaceBelow}. */
148 public static final Object SpaceBelow
= ParagraphConstants
.SpaceBelow
;
150 /** An alias for {@link ParagraphConstants#TabSet}. */
151 public static final Object TabSet
= ParagraphConstants
.TabSet
;
153 public static final String ComponentElementName
= "component";
155 public static final String IconElementName
= "icon";
157 public static final Object ComposedTextAttribute
158 = new StyleConstants("composed text");
160 public static final Object ModelAttribute
= new StyleConstants("model");
162 public static final Object NameAttribute
= new StyleConstants("name");
164 public static final Object ResolveAttribute
= new StyleConstants("resolver");
168 // Package-private to avoid accessor constructor for use by
170 StyleConstants(String k
)
176 * Returns a string representation of the attribute key.
178 * @return A string representation of the attribute key.
180 public String
toString()
186 * Returns the alignment specified in the given attributes, or
187 * {@link #ALIGN_LEFT} if no alignment is specified.
189 * @param a the attribute set (<code>null</code> not permitted).
191 * @return The alignment (typically one of {@link #ALIGN_LEFT},
192 * {@link #ALIGN_RIGHT}, {@link #ALIGN_CENTER} or
193 * {@link #ALIGN_JUSTIFIED}).
195 * @see #setAlignment(MutableAttributeSet, int)
197 public static int getAlignment(AttributeSet a
)
199 Integer i
= (Integer
) a
.getAttribute(Alignment
);
207 * Returns the background color specified in the given attributes, or
208 * {@link Color#BLACK} if no background color is specified.
210 * @param a the attribute set (<code>null</code> not permitted).
212 * @return The background color.
214 * @see #setBackground(MutableAttributeSet, Color)
216 public static Color
getBackground(AttributeSet a
)
218 Color c
= (Color
) a
.getAttribute(Background
);
226 * Returns the bidi level specified in the given attributes, or
227 * <code>0</code> if no bidi level is specified.
229 * @param a the attribute set (<code>null</code> not permitted).
231 * @return The bidi level.
233 * @see #setBidiLevel(MutableAttributeSet, int)
235 public static int getBidiLevel(AttributeSet a
)
237 Integer i
= (Integer
) a
.getAttribute(BidiLevel
);
245 * Returns the component specified in the given attributes, or
246 * <code>null</code> if no component is specified.
248 * @param a the attribute set (<code>null</code> not permitted).
250 * @return The component (possibly <code>null</code>).
252 * @see #setComponent(MutableAttributeSet, Component)
254 public static Component
getComponent(AttributeSet a
)
256 Component c
= (Component
) a
.getAttribute(ComponentAttribute
);
264 * Returns the indentation specified in the given attributes, or
265 * <code>0.0f</code> if no indentation is specified.
267 * @param a the attribute set (<code>null</code> not permitted).
269 * @return The indentation.
271 * @see #setFirstLineIndent(MutableAttributeSet, float)
273 public static float getFirstLineIndent(AttributeSet a
)
275 Float f
= (Float
) a
.getAttribute(FirstLineIndent
);
277 return f
.floatValue();
283 * Returns the font family specified in the given attributes, or
284 * <code>Monospaced</code> if no font family is specified.
286 * @param a the attribute set (<code>null</code> not permitted).
288 * @return The font family.
290 * @see #setFontFamily(MutableAttributeSet, String)
292 public static String
getFontFamily(AttributeSet a
)
294 String ff
= (String
) a
.getAttribute(FontFamily
);
302 * Returns the font size specified in the given attributes, or
303 * <code>12</code> if no font size is specified.
305 * @param a the attribute set (<code>null</code> not permitted).
307 * @return The font size.
309 * @see #setFontSize(MutableAttributeSet, int)
311 public static int getFontSize(AttributeSet a
)
313 Integer i
= (Integer
) a
.getAttribute(FontSize
);
321 * Returns the foreground color specified in the given attributes, or
322 * {@link Color#BLACK} if no foreground color is specified.
324 * @param a the attribute set (<code>null</code> not permitted).
326 * @return The foreground color.
328 * @see #setForeground(MutableAttributeSet, Color)
330 public static Color
getForeground(AttributeSet a
)
332 Color c
= (Color
) a
.getAttribute(Foreground
);
340 * Returns the icon specified in the given attributes, or
341 * <code>null</code> if no icon is specified.
343 * @param a the attribute set (<code>null</code> not permitted).
345 * @return The icon (possibly <code>null</code>).
347 * @see #setIcon(MutableAttributeSet, Icon)
349 public static Icon
getIcon(AttributeSet a
)
351 return (Icon
) a
.getAttribute(IconAttribute
);
355 * Returns the left indentation specified in the given attributes, or
356 * <code>0.0f</code> if no left indentation is specified.
358 * @param a the attribute set (<code>null</code> not permitted).
360 * @return The left indentation.
362 * @see #setLeftIndent(MutableAttributeSet, float)
364 public static float getLeftIndent(AttributeSet a
)
366 Float f
= (Float
) a
.getAttribute(LeftIndent
);
368 return f
.floatValue();
374 * Returns the line spacing specified in the given attributes, or
375 * <code>0.0f</code> if no line spacing is specified.
377 * @param a the attribute set (<code>null</code> not permitted).
379 * @return The line spacing.
381 * @see #setLineSpacing(MutableAttributeSet, float)
383 public static float getLineSpacing(AttributeSet a
)
385 Float f
= (Float
) a
.getAttribute(LineSpacing
);
387 return f
.floatValue();
393 * Returns the right indentation specified in the given attributes, or
394 * <code>0.0f</code> if no right indentation is specified.
396 * @param a the attribute set (<code>null</code> not permitted).
398 * @return The right indentation.
400 * @see #setRightIndent(MutableAttributeSet, float)
402 public static float getRightIndent(AttributeSet a
)
404 Float f
= (Float
) a
.getAttribute(RightIndent
);
406 return f
.floatValue();
412 * Returns the 'space above' specified in the given attributes, or
413 * <code>0.0f</code> if no 'space above' is specified.
415 * @param a the attribute set (<code>null</code> not permitted).
417 * @return The 'space above'.
419 * @see #setSpaceAbove(MutableAttributeSet, float)
421 public static float getSpaceAbove(AttributeSet a
)
423 Float f
= (Float
) a
.getAttribute(SpaceAbove
);
425 return f
.floatValue();
431 * Returns the 'space below' specified in the given attributes, or
432 * <code>0.0f</code> if no 'space below' is specified.
434 * @param a the attribute set (<code>null</code> not permitted).
436 * @return The 'space below'.
438 * @see #setSpaceBelow(MutableAttributeSet, float)
440 public static float getSpaceBelow(AttributeSet a
)
442 Float f
= (Float
) a
.getAttribute(SpaceBelow
);
444 return f
.floatValue();
450 * Returns the tab set specified in the given attributes, or
451 * <code>null</code> if no tab set is specified.
453 * @param a the attribute set (<code>null</code> not permitted).
455 * @return The tab set.
457 * @see #setTabSet(MutableAttributeSet, javax.swing.text.TabSet)
459 public static javax
.swing
.text
.TabSet
getTabSet(AttributeSet a
)
461 // I'm guessing that the fully qualified class name is to differentiate
462 // between the TabSet class and the TabSet (attribute) instance on some
464 return (javax
.swing
.text
.TabSet
) a
.getAttribute(StyleConstants
.TabSet
);
468 * Returns the value of the bold flag in the given attributes, or
469 * <code>false</code> if no bold flag is specified.
471 * @param a the attribute set (<code>null</code> not permitted).
473 * @return The bold flag.
475 * @see #setBold(MutableAttributeSet, boolean)
477 public static boolean isBold(AttributeSet a
)
479 Boolean b
= (Boolean
) a
.getAttribute(Bold
);
481 return b
.booleanValue();
487 * Returns the value of the italic flag in the given attributes, or
488 * <code>false</code> if no italic flag is specified.
490 * @param a the attribute set (<code>null</code> not permitted).
492 * @return The italic flag.
494 * @see #setItalic(MutableAttributeSet, boolean)
496 public static boolean isItalic(AttributeSet a
)
498 Boolean b
= (Boolean
) a
.getAttribute(Italic
);
500 return b
.booleanValue();
506 * Returns the value of the strike-through flag in the given attributes, or
507 * <code>false</code> if no strike-through flag is specified.
509 * @param a the attribute set (<code>null</code> not permitted).
511 * @return The strike-through flag.
513 * @see #setStrikeThrough(MutableAttributeSet, boolean)
515 public static boolean isStrikeThrough(AttributeSet a
)
517 Boolean b
= (Boolean
) a
.getAttribute(StrikeThrough
);
519 return b
.booleanValue();
525 * Returns the value of the subscript flag in the given attributes, or
526 * <code>false</code> if no subscript flag is specified.
528 * @param a the attribute set (<code>null</code> not permitted).
530 * @return The subscript flag.
532 * @see #setSubscript(MutableAttributeSet, boolean)
534 public static boolean isSubscript(AttributeSet a
)
536 Boolean b
= (Boolean
) a
.getAttribute(Subscript
);
538 return b
.booleanValue();
544 * Returns the value of the superscript flag in the given attributes, or
545 * <code>false</code> if no superscript flag is specified.
547 * @param a the attribute set (<code>null</code> not permitted).
549 * @return The superscript flag.
551 * @see #setSuperscript(MutableAttributeSet, boolean)
553 public static boolean isSuperscript(AttributeSet a
)
555 Boolean b
= (Boolean
) a
.getAttribute(Superscript
);
557 return b
.booleanValue();
563 * Returns the value of the underline flag in the given attributes, or
564 * <code>false</code> if no underline flag is specified.
566 * @param a the attribute set (<code>null</code> not permitted).
568 * @return The underline flag.
570 * @see #setUnderline(MutableAttributeSet, boolean)
572 public static boolean isUnderline(AttributeSet a
)
574 Boolean b
= (Boolean
) a
.getAttribute(Underline
);
576 return b
.booleanValue();
582 * Adds an alignment attribute to the specified set.
584 * @param a the attribute set (<code>null</code> not permitted).
585 * @param align the alignment (typically one of
586 * {@link StyleConstants#ALIGN_LEFT},
587 * {@link StyleConstants#ALIGN_RIGHT},
588 * {@link StyleConstants#ALIGN_CENTER} or
589 * {@link StyleConstants#ALIGN_JUSTIFIED}).
591 * @throws NullPointerException if <code>a</code> is <code>null</code>.
593 * @see #getAlignment(AttributeSet)
595 public static void setAlignment(MutableAttributeSet a
, int align
)
597 a
.addAttribute(Alignment
, new Integer(align
));
601 * Adds a background attribute to the specified set.
603 * @param a the attribute set (<code>null</code> not permitted).
604 * @param bg the background (<code>null</code> not permitted).
606 * @throws NullPointerException if either argument is <code>null</code>.
608 * @see #getBackground(AttributeSet)
610 public static void setBackground(MutableAttributeSet a
, Color bg
)
612 a
.addAttribute(Background
, bg
);
616 * Adds a bidi-level attribute to the specified set.
618 * @param a the attribute set (<code>null</code> not permitted).
619 * @param lev the level.
621 * @throws NullPointerException if <code>a</code> is <code>null</code>.
623 * @see #getBidiLevel(AttributeSet)
625 public static void setBidiLevel(MutableAttributeSet a
, int lev
)
627 a
.addAttribute(BidiLevel
, new Integer(lev
));
631 * Adds a bold attribute to the specified set.
633 * @param a the attribute set (<code>null</code> not permitted).
634 * @param b the new value of the bold attribute.
636 * @throws NullPointerException if <code>a</code> is <code>null</code>.
638 * @see #isBold(AttributeSet)
640 public static void setBold(MutableAttributeSet a
, boolean b
)
642 a
.addAttribute(Bold
, Boolean
.valueOf(b
));
646 * Adds a component attribute to the specified set.
648 * @param a the attribute set (<code>null</code> not permitted).
649 * @param c the component (<code>null</code> not permitted).
651 * @throws NullPointerException if either argument is <code>null</code>.
653 * @see #getComponent(AttributeSet)
655 public static void setComponent(MutableAttributeSet a
, Component c
)
657 a
.addAttribute(ComponentAttribute
, c
);
661 * Adds a first line indentation attribute to the specified set.
663 * @param a the attribute set (<code>null</code> not permitted).
664 * @param i the indentation.
666 * @throws NullPointerException if <code>a</code> is <code>null</code>.
668 * @see #getFirstLineIndent(AttributeSet)
670 public static void setFirstLineIndent(MutableAttributeSet a
, float i
)
672 a
.addAttribute(FirstLineIndent
, new Float(i
));
676 * Adds a font family attribute to the specified set.
678 * @param a the attribute set (<code>null</code> not permitted).
679 * @param fam the font family name (<code>null</code> not permitted).
681 * @throws NullPointerException if either argument is <code>null</code>.
683 * @see #getFontFamily(AttributeSet)
685 public static void setFontFamily(MutableAttributeSet a
, String fam
)
687 a
.addAttribute(FontFamily
, fam
);
691 * Adds a font size attribute to the specified set.
693 * @param a the attribute set (<code>null</code> not permitted).
694 * @param s the font size (in points).
696 * @throws NullPointerException if <code>a</code> is <code>null</code>.
698 * @see #getFontSize(AttributeSet)
700 public static void setFontSize(MutableAttributeSet a
, int s
)
702 a
.addAttribute(FontSize
, new Integer(s
));
706 * Adds a foreground color attribute to the specified set.
708 * @param a the attribute set (<code>null</code> not permitted).
709 * @param fg the foreground color (<code>null</code> not permitted).
711 * @throws NullPointerException if either argument is <code>null</code>.
713 * @see #getForeground(AttributeSet)
715 public static void setForeground(MutableAttributeSet a
, Color fg
)
717 a
.addAttribute(Foreground
, fg
);
721 * Adds an icon attribute to the specified set.
723 * @param a the attribute set (<code>null</code> not permitted).
724 * @param c the icon (<code>null</code> not permitted).
726 * @throws NullPointerException if either argument is <code>null</code>.
728 * @see #getIcon(AttributeSet)
730 public static void setIcon(MutableAttributeSet a
, Icon c
)
732 a
.addAttribute(IconAttribute
, c
);
736 * Adds an italic attribute to the specified set.
738 * @param a the attribute set (<code>null</code> not permitted).
739 * @param b the new value of the italic attribute.
741 * @throws NullPointerException if <code>a</code> is <code>null</code>.
743 * @see #isItalic(AttributeSet)
745 public static void setItalic(MutableAttributeSet a
, boolean b
)
747 a
.addAttribute(Italic
, Boolean
.valueOf(b
));
751 * Adds a left indentation attribute to the specified set.
753 * @param a the attribute set (<code>null</code> not permitted).
754 * @param i the indentation.
756 * @throws NullPointerException if <code>a</code> is <code>null</code>.
758 * @see #getLeftIndent(AttributeSet)
760 public static void setLeftIndent(MutableAttributeSet a
, float i
)
762 a
.addAttribute(LeftIndent
, new Float(i
));
766 * Adds a line spacing attribute to the specified set.
768 * @param a the attribute set (<code>null</code> not permitted).
769 * @param i the line spacing.
771 * @throws NullPointerException if <code>a</code> is <code>null</code>.
773 * @see #getLineSpacing(AttributeSet)
775 public static void setLineSpacing(MutableAttributeSet a
, float i
)
777 a
.addAttribute(LineSpacing
, new Float(i
));
781 * Adds a right indentation attribute to the specified set.
783 * @param a the attribute set (<code>null</code> not permitted).
784 * @param i the right indentation.
786 * @throws NullPointerException if <code>a</code> is <code>null</code>.
788 * @see #getRightIndent(AttributeSet)
790 public static void setRightIndent(MutableAttributeSet a
, float i
)
792 a
.addAttribute(RightIndent
, new Float(i
));
796 * Adds a 'space above' attribute to the specified set.
798 * @param a the attribute set (<code>null</code> not permitted).
799 * @param i the space above attribute value.
801 * @throws NullPointerException if <code>a</code> is <code>null</code>.
803 * @see #getSpaceAbove(AttributeSet)
805 public static void setSpaceAbove(MutableAttributeSet a
, float i
)
807 a
.addAttribute(SpaceAbove
, new Float(i
));
811 * Adds a 'space below' attribute to the specified set.
813 * @param a the attribute set (<code>null</code> not permitted).
814 * @param i the space below attribute value.
816 * @throws NullPointerException if <code>a</code> is <code>null</code>.
818 * @see #getSpaceBelow(AttributeSet)
820 public static void setSpaceBelow(MutableAttributeSet a
, float i
)
822 a
.addAttribute(SpaceBelow
, new Float(i
));
826 * Adds a strike-through attribue to the specified set.
828 * @param a the attribute set (<code>null</code> not permitted).
829 * @param b the strike-through attribute value.
831 * @throws NullPointerException if <code>a</code> is <code>null</code>.
833 * @see #isStrikeThrough(AttributeSet)
835 public static void setStrikeThrough(MutableAttributeSet a
, boolean b
)
837 a
.addAttribute(StrikeThrough
, Boolean
.valueOf(b
));
841 * Adds a subscript attribute to the specified set.
843 * @param a the attribute set (<code>null</code> not permitted).
844 * @param b the subscript attribute value.
846 * @throws NullPointerException if <code>a</code> is <code>null</code>.
848 * @see #isSubscript(AttributeSet)
850 public static void setSubscript(MutableAttributeSet a
, boolean b
)
852 a
.addAttribute(Subscript
, Boolean
.valueOf(b
));
856 * Adds a superscript attribute to the specified set.
858 * @param a the attribute set (<code>null</code> not permitted).
859 * @param b the superscript attribute value.
861 * @throws NullPointerException if <code>a</code> is <code>null</code>.
863 * @see #isSuperscript(AttributeSet)
865 public static void setSuperscript(MutableAttributeSet a
, boolean b
)
867 a
.addAttribute(Superscript
, Boolean
.valueOf(b
));
871 * Adds a {@link TabSet} attribute to the specified set.
873 * @param a the attribute set (<code>null</code> not permitted).
874 * @param tabs the tab set (<code>null</code> not permitted).
876 * @throws NullPointerException if either argument is <code>null</code>.
878 * @see #getTabSet(AttributeSet)
880 public static void setTabSet(MutableAttributeSet a
,
881 javax
.swing
.text
.TabSet tabs
)
883 a
.addAttribute(StyleConstants
.TabSet
, tabs
);
887 * Adds an underline attribute to the specified set.
889 * @param a the attribute set (<code>null</code> not permitted).
890 * @param b the underline attribute value.
892 * @throws NullPointerException if <code>a</code> is <code>null</code>.
894 * @see #isUnderline(AttributeSet)
896 public static void setUnderline(MutableAttributeSet a
, boolean b
)
898 a
.addAttribute(Underline
, Boolean
.valueOf(b
));
901 // The remainder are so-called "typesafe enumerations" which
902 // alias subsets of the above constants.
905 * A set of keys for attributes that apply to characters.
907 public static class CharacterConstants
908 extends StyleConstants
909 implements AttributeSet
.CharacterAttribute
912 * Private constructor prevents new instances being created.
914 * @param k the key name.
916 private CharacterConstants(String k
)
921 /** An alias for {@link ColorConstants#Background}. */
922 public static final Object Background
= ColorConstants
.Background
;
924 /** A key for the bidi level character attribute. */
925 public static final Object BidiLevel
= new CharacterConstants("bidiLevel");
927 /** An alias for {@link FontConstants#Bold}. */
928 public static final Object Bold
= FontConstants
.Bold
;
930 /** A key for the component character attribute. */
931 public static final Object ComponentAttribute
932 = new CharacterConstants("component");
934 /** An alias for {@link FontConstants#Family}. */
935 public static final Object Family
= FontConstants
.Family
;
937 /** An alias for {@link FontConstants#Size}. */
938 public static final Object Size
= FontConstants
.Size
;
940 /** An alias for {@link ColorConstants#Foreground}. */
941 public static final Object Foreground
= ColorConstants
.Foreground
;
943 /** A key for the icon character attribute. */
944 public static final Object IconAttribute
= new CharacterConstants("icon");
946 /** A key for the italic character attribute. */
947 public static final Object Italic
= FontConstants
.Italic
;
949 /** A key for the strike through character attribute. */
950 public static final Object StrikeThrough
951 = new CharacterConstants("strikethrough");
953 /** A key for the subscript character attribute. */
954 public static final Object Subscript
= new CharacterConstants("subscript");
956 /** A key for the superscript character attribute. */
957 public static final Object Superscript
958 = new CharacterConstants("superscript");
960 /** A key for the underline character attribute. */
961 public static final Object Underline
= new CharacterConstants("underline");
966 * A set of keys for attributes that relate to colors.
968 public static class ColorConstants
969 extends StyleConstants
970 implements AttributeSet
.ColorAttribute
, AttributeSet
.CharacterAttribute
973 * Private constructor prevents new instances being created.
975 * @param k the key name.
977 private ColorConstants(String k
)
982 /** A key for the foreground color attribute. */
983 public static final Object Foreground
= new ColorConstants("foreground");
985 /** A key for the background color attribute. */
986 public static final Object Background
= new ColorConstants("background");
990 * A set of keys for attributes that apply to fonts.
992 public static class FontConstants
993 extends StyleConstants
994 implements AttributeSet
.FontAttribute
, AttributeSet
.CharacterAttribute
997 * Private constructor prevents new instances being created.
999 * @param k the key name.
1001 private FontConstants(String k
)
1006 /** A key for the bold font attribute. */
1007 public static final Object Bold
= new FontConstants("bold");
1009 /** A key for the family font attribute. */
1010 public static final Object Family
= new FontConstants("family");
1012 /** A key for the italic font attribute. */
1013 public static final Object Italic
= new FontConstants("italic");
1015 /** A key for the size font attribute. */
1016 public static final Object Size
= new FontConstants("size");
1020 * A set of keys for attributes that apply to paragraphs.
1022 public static class ParagraphConstants
1023 extends StyleConstants
1024 implements AttributeSet
.ParagraphAttribute
1027 * Private constructor prevents new instances being created.
1029 * @param k the key name.
1031 private ParagraphConstants(String k
)
1036 /** A key for the alignment paragraph attribute. */
1037 public static final Object Alignment
= new ParagraphConstants("Alignment");
1039 /** A key for the first line indentation paragraph attribute. */
1040 public static final Object FirstLineIndent
1041 = new ParagraphConstants("FirstLineIndent");
1043 /** A key for the left indentation paragraph attribute. */
1044 public static final Object LeftIndent
1045 = new ParagraphConstants("LeftIndent");
1047 /** A key for the line spacing paragraph attribute. */
1048 public static final Object LineSpacing
1049 = new ParagraphConstants("LineSpacing");
1051 /** A key for the orientation paragraph attribute. */
1052 public static final Object Orientation
1053 = new ParagraphConstants("Orientation");
1055 /** A key for the right indentation paragraph attribute. */
1056 public static final Object RightIndent
1057 = new ParagraphConstants("RightIndent");
1059 /** A key for the 'space above' paragraph attribute. */
1060 public static final Object SpaceAbove
1061 = new ParagraphConstants("SpaceAbove");
1063 /** A key for the 'space below' paragraph attribute. */
1064 public static final Object SpaceBelow
1065 = new ParagraphConstants("SpaceBelow");
1067 /** A key for the tabset paragraph attribute. */
1068 public static final Object TabSet
= new ParagraphConstants("TabSet");